MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  Account information  AccountFreeMarginCheck

 
Use the opportunities of
MQL5 in MetaTrader 5
Study the new MQL5 language
Study the new MQL5 language.
Reference is already available
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;