Hello,
I would like to know the expression to calculate :
In my EA I would make something like this :
- I try 1 lot
- If the free margin is not ok, I try 0.9 lots
- If the free margin is not ok, I try 0.8 lots
- and continue until have the minimum lots to open an order
Have you got an expression to make this ?
Thank you...
https://docs.mql4.com/account/AccountFreeMargin
double Risk=3; // percent of free margin to calculate lot size. double Lots=NormalizeDouble(AccountFreeMargin()*Risk/100/1000.0,1); // Standard lot size
Hello and thank you...
Could you explain numbers "100" and "1000" ?!?
Thanks a lot !
Hello,
I found the answer :
double MargRequired = MarketInfo ( Symbol ( ), MODE_MARGINREQUIRED ) ; // current price * 1000
double Equity = AccountEquity ( ) ;
double Max_Lots = NormalizeDouble ( Equity / MargRequired, 1 ) ;
With this data, I now know what is the maximum lots I could trade.
Thank you !

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I would like to know the expression to calculate :
In my EA I would make something like this :
- I try 1 lot
- If the free margin is not ok, I try 0.9 lots
- If the free margin is not ok, I try 0.8 lots
- and continue until have the minimum lots to open an order
Have you got an expression to make this ?
Thank you...