MT5 error 4752: Automated trading is not allowed for the program (ERR_TRADE_DISABLED)
The terminal or this program isn't allowed to trade, so OrderSend refused before sending. Check Algo Trading and the program's settings.
What it means
You see this code in GetLastError() in MQL5, after a function fails.
MQL5 programs need permission to trade, both in the terminal as a whole and for each program. Without it, trade functions fail with 4752.
The request was stopped inside the terminal. The broker never saw it.
Common causes
- The Algo Trading button in the toolbar is off.
- The program was attached without "Allow Algo Trading" in its settings.
- The terminal options don't allow algorithmic trading.
- A program type that can't trade, such as an indicator.
How to fix it
- Turn on Algo Trading in the toolbar.
- Open the program's settings and allow algorithmic trading.
- Check
TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)andMQLInfoInteger(MQL_TRADE_ALLOWED)at start up.
Example in MQL5:
int OnInit()
{
if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED))
Print("Algo Trading is off in the terminal");
if(!MQLInfoInteger(MQL_TRADE_ALLOWED))
Print("This program was attached without permission to trade");
return INIT_SUCCEEDED;
} Is it safe to retry?
Yes, once trading is allowed. Nothing was sent.
Could the order have executed?
No. The terminal blocked it.
How Tickwire handles it
Tickwire checks that trading is switched on in the terminal before sending. If it is off, the order comes back as 10027 with nothing sent, and health shows trading_enabled false. See health.
Related codes
- MT5 error 10027: Autotrading disabled by client terminal (TRADE_RETCODE_CLIENT_DISABLES_AT)
- MT5 error 10026: Autotrading disabled by server (TRADE_RETCODE_SERVER_DISABLES_AT)
- MT4 error 4109: Trade is not allowed (ERR_TRADE_NOT_ALLOWED)
- MT5 error 4014: Function is not allowed for call (ERR_FUNCTION_NOT_ALLOWED)
One API for MT4 and MT5
Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.