Skip to content

Trade server return code

10027 TRADE_RETCODE_CLIENT_DISABLES_AT

Algo trading is switched off in the terminal

What it means

The terminal itself blocked the request because algorithmic trading is off. The reference's OrderCheck example shows the pair you see in the journal: the check fails with error 4752 and the server retcode is 10027 ("AutoTrading disabled by client").

Common causes

  • The Algo Trading button on the terminal's toolbar is off (TERMINAL_TRADE_ALLOWED is false).
  • "Allow Algo Trading" is not ticked on the Common tab of the EA's properties (MQL_TRADE_ALLOWED is false).
  • The terminal switched algo trading off by itself after the account or profile changed, if that option is set in Tools > Options > Expert Advisors.
  • The EA was attached from a template or profile saved without the permission.

A real scenario

A trader moves a working EA to a new VPS by loading a saved profile. The charts and the EA come back, but the terminal's Algo Trading button is off on the new installation, so every signal ends with 10027 and no trade is opened for two days. A status line on the chart that says "Algo Trading is off" would have shown it on the first tick.

How to fix it

  1. Check TERMINAL_TRADE_ALLOWED and MQL_TRADE_ALLOWED before trading and say which one is off.
  2. Show the state on the chart (Comment()), not only in the journal, so it is seen without opening the logs.
  3. After moving to a new terminal or VPS, check the Algo Trading button and the EA's Common tab.

Fixed MQL5 code

MQL5
bool AlgoTradingOn()
{
   if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED))
   {
      Comment("Algo Trading is off in the terminal: press the Algo Trading button on the toolbar");
      return false;
   }
   if(!MQLInfoInteger(MQL_TRADE_ALLOWED))
   {
      Comment("This EA may not trade: tick \"Allow Algo Trading\" on the Common tab of its properties");
      return false;
   }
   Comment("");
   return true;
}

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 10027? 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.