Use AccountFreeMarginCheck(). Place it within a For() Loop and keep adding Broker Minimum-Lots until the free margin which remains = 0. Then go with the value which triggers 0.
double AccountFreeMarginCheck( string symbol, int cmd, double volume) Returns free margin that remains after the specified position has been opened at the current price on the current account. If the free margin is insufficient, an error 134 (ERR_NOT_ENOUGH_MONEY) will be generated. Parameters: symbol - Symbol for trading operation. cmd - Operation type. It can be either OP_BUY or OP_SELL. volume - Number of lots. Sample: if(AccountFreeMarginCheck(Symbol(),OP_BUY,Lots)<=0 || GetLastError()==134) return;

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I would like to have Function to buy 100%margin.
I do not know calculation method.
Please I would like to know if there is script