MT5 error 10017: Trade is disabled (TRADE_RETCODE_TRADE_DISABLED)

Trading is switched off for this symbol or this account. Nothing was executed; retrying won't help until the broker enables it.

10017TRADE_RETCODE_TRADE_DISABLED
NoSafe 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 broker doesn't allow trading here right now. Either the symbol's trade mode is disabled, or the account itself can't trade.

This is a setting, not a market condition, so it doesn't clear by itself in a few seconds.

Common causes

  • A symbol with trade_mode 0 (disabled), such as an index shown for reference only.
  • An account logged in with the investor (read only) password.
  • An account that the broker has disabled or moved to a read only group.
  • A symbol being retired or rolled over.

How to fix it

  • Check symbol_info(name).trade_mode. 0 is disabled, 3 is close only and 4 is full trading.
  • Check account_info().trade_allowed. False often means an investor login.
  • Ask the broker if the account or symbol should be tradable.

Example in Python:

import MetaTrader5 as mt5

acc = mt5.account_info()
s = mt5.symbol_info("US500")
print("account can trade:", acc.trade_allowed)
# 0 disabled, 1 long only, 2 short only, 3 close only, 4 full
print("symbol trade mode:", s.trade_mode)

Is it safe to retry?

No, not until the setting changes. Retrying sends the same refused request.

Could the order have executed?

No. Nothing was traded.

How Tickwire handles it

Tickwire reads the symbol's trade mode before sending and refuses an order the mode doesn't allow, with nothing sent. An investor login is refused before sending too.

Health shows trading_enabled false when the account can't trade. See health.

MT4 errors 7, 64, 65 and 133 come back as 10017.

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.