DislikedIn the meantime... as for a formula, I too am not a mathematician. I'll have a hunt through some other bots and see if I can find anything that looks like it might work. Enjoy your weekend.Ignored
//-- external input
extern double LotPercent = 2.0 // mean 2.0%
//-- pass variable
double LotSize;
void LotsCalc() {
if(MarketInfo(Symbol(),MODE_MINLOT) == 0.1) int LotsDigit = 1;
else if(MarketInfo(Symbol(),MODE_MINLOT) == 0.01) LotsDigit = 2;
double MinLots = NormalizeDouble(MarketInfo(Symbol(),MODE_MINLOT),LotsDigit);
double MaxLots = NormalizeDouble(MarketInfo(Symbol(),MODE_MAXLOT),LotsDigit);
double AcFrMar = NormalizeDouble(AccountFreeMargin(),2);
LotSize = (AcFrMar*(LotsPercent/100))/1000;
if(LotSize > MaxLots) LotSize = MaxLots;
if(LotSize < MinLots) LotSize = MinLots;
}