int lotsDigits=MathLog10(MarketInfo("EURUSD",MODE_MINLOT)); // I deleted " (int)- "

**NormalizeDouble**()

The purpose is to get "valid" volume size number, e.g. 0.02 , etc.

MarketInfo("EURUSD",MODE_MAXLOT) MarketInfo("EURUSD",MODE_MINLOT)

Get the maximum/minumym volume limit of the pair, e.g. "EURUSD"

maximumRisk (normally in percentage of e.g. Free Margin) newlots = AccountFreeMargin() * maximumRisk / (500000.0/AccountLeverage()) lots=NormalizeDouble(newlots)

Why the number 500000.0 ?

No idea, probably an upper limit / a fix balance ?

You might want to simplify the
formula to

maximumRisk = 2.5 newlots = AccountFreeMargin() * maximumRisk / 100.0 lots = NormalizeDouble(newlots)

Good luck.

PS: Try to format your post according to forum's standard, especially regarding SOURCE CODE formatting.

It
makes reading your source code easier.

You can refer to https://docs.mql4.com/function_indices and https://www.mql5.com/en/docs/function_indices to
understand what those MT4/MT5 functions do.

I couldn't get in touch with the author , therefore I decided to ask in the forum to help me understand some function :

Thank you in advance, please bare in mind that I am not professional IT or trader. so I am just an amateur, but I like to study more in Mql4 and EA, so please help me understand some code. I DO have studied some from books/youtubes/etc, but still can not figure out some, such as this one :

-qte-

//+------------------------------------------------------------------+

//| Calculate position volume |

//+------------------------------------------------------------------+

double Lots()

{

double maximumRisk=0.1;

int lotsDigits=MathLog10(MarketInfo("EURUSD",MODE_MINLOT)); // I deleted " (int)- "

double lots=NormalizeDouble(AccountFreeMargin()*maximumRisk/(500000.0/AccountLeverage()),lotsDigits);

if(lots>MarketInfo("EURUSD",MODE_MAXLOT))

lots=MarketInfo("EURUSD",MODE_MAXLOT);

if(lots<MarketInfo("EURUSD",MODE_MINLOT))

lots=MarketInfo("EURUSD",MODE_MINLOT);

return(lots);

}

- unqte -

can explain line by line whats meaning ? and especially why there is this '500000.0' ?

Thanks you

Regards

Seanlu21