MT5 error 10027: Autotrading disabled by client terminal (TRADE_RETCODE_CLIENT_DISABLES_AT)

Algo Trading is switched off in the MetaTrader 5 terminal, so it won't send orders from code. Turn it on and send again.

10027TRADE_RETCODE_CLIENT_DISABLES_AT
After a fixSafe to retry?
NoCould it have executed?

What it means

You see this code in the retcode of a trade result, from OrderSend() in MQL5 or order_send() in Python.

The terminal itself is blocking automated trading. The Algo Trading button in the toolbar is off, or the terminal settings don't allow algorithmic trading.

The request never left the terminal. The broker didn't see it.

Common causes

  • The Algo Trading button was clicked off, by hand or by a hotkey.
  • The terminal turned it off by itself, for example after a change of account.
  • A program attached without permission to trade.

How to fix it

  • Turn on the Algo Trading button and check the matching option in the terminal settings.
  • Check terminal_info().trade_allowed before sending, and alert yourself if it is false.
  • For an MQL5 program, also check that it was allowed to trade when it was attached.

Example in Python:

import MetaTrader5 as mt5

term = mt5.terminal_info()
if not term.trade_allowed:
    raise SystemExit("Algo Trading is off in the terminal: switch it on first")

Is it safe to retry?

Yes, once trading is switched on. Nothing was sent the first time.

Could the order have executed?

No. The terminal stopped it before it reached the broker.

How Tickwire handles it

Tickwire checks that trading is switched on in the terminal before sending. If it is off, you get 10027 and nothing is sent.

Health shows trading_enabled false in that state, so a monitor can catch it before an order fails. See health.

MT4 runtime error 4109 comes back as 10027.

Related MT5 Python functions

All MetaTrader error codes

One API for MT4 and MT5

Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.