Skip to content

Runtime error

4752 ERR_TRADE_DISABLED

Trading by Expert Advisors prohibited

What it means

The program is not allowed to trade. The reference's OrderCheck example shows it with algo trading off: "Trade request verification completed with error 4752", with the server retcode 10027. Besides the terminal and the EA's own permission, the broker can forbid EAs on an account (ACCOUNT_TRADE_EXPERT, "Allowed trade for an Expert Advisor").

Common causes

  • The terminal's Algo Trading button is off.
  • The EA's "Allow Algo Trading" permission is not ticked.
  • The broker or prop firm does not allow EAs on this account (ACCOUNT_TRADE_EXPERT is false).

A real scenario

A trader runs an EA on a new prop-firm account and sees 4752 although the Algo Trading button is green and the EA's box is ticked. The account's ACCOUNT_TRADE_EXPERT is false: that account type does not allow EAs. Only the broker can change it, and the EA now says so on the chart instead of failing silently.

How to fix it

  1. Check the three permissions in order and show which one is missing.
  2. Run the check in OnInit() and again before trading, since the user can switch Algo Trading off at any time.
  3. When ACCOUNT_TRADE_EXPERT is false, the fix is with the broker, not in the code.

Fixed MQL5 code

MQL5
string TradeBlocker()
{
   if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) return "Algo Trading is off in the terminal";
   if(!MQLInfoInteger(MQL_TRADE_ALLOWED))           return "Allow Algo Trading in this EA's properties (Common tab)";
   if(!AccountInfoInteger(ACCOUNT_TRADE_EXPERT))    return "The broker does not allow EAs on this account";
   if(!AccountInfoInteger(ACCOUNT_TRADE_ALLOWED))   return "This account cannot trade (investor password?)";
   return "";
}

void OnTick()
{
   string blocker = TradeBlocker();
   Comment(blocker);                                // the reason stays visible on the chart
   if(blocker != "")
      return;
   // ... signals and orders ...
}

A focused example for MetaTrader 5: adapt names, magic number and limits to your EA, and test it on a demo account first.

EA Doctor rules that catch it

  • LowAlgo trading permission not checkedThe EA sends orders without checking that algo trading is allowed in the terminal, for the EA and on the account, so every order fails when one is off.

Sources

Get your EA fixed

Still failing with 4752? Send us the EA and the journal lines: we find the cause in the code and fix it. Or check it yourself first with the EA Doctor.