ACCOUNT_TRADE_ALLOWED bug in MetaTrader 5 build 2940

 
  • In backtest everything's working properly: AccountInfoInteger(ACCOUNT_TRADE_ALLOWED)) returns 1 (true)
  • On a real or demo account: AccountInfoInteger(ACCOUNT_TRADE_ALLOWED)) always returns 0 (false) 
 
Besarion Turmanauli:
  • In backtest everything's working properly: AccountInfoInteger(ACCOUNT_TRADE_ALLOWED)) returns 1 (true)
  • On a real or demo account: AccountInfoInteger(ACCOUNT_TRADE_ALLOWED)) always returns 0 (false) 

So what ?

Use an account where trading is enabled.

Trade Permission

AccountInfoInteger(ACCOUNT_TRADE_ALLOWED) may return false in the following cases:

  • no connection to the trade server. That can be checked using TerminalInfoInteger(TERMINAL_CONNECTED);
  • trading account switched to read-only mode (sent to the archive);
  • trading on the account is disabled at the trade server side;
  • connection to a trading account has been performed in Investor mode.
Documentation on MQL5: MQL5 programs / Trade Permission
Documentation on MQL5: MQL5 programs / Trade Permission
  • www.mql5.com
Trade Permission - MQL5 programs - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Alain Verleyen:

So what ?

Use an account where trading is enabled.

Trade Permission

Thank you,

I actually verified and seems that trade server was responsible for the value returned, because in this case it only returns false when there are no funds on the account, however, when I switch to a funded account, true (1.0) is returned.