MT5 error codes, in MQL5's words
Type the number after retcode= in the Experts or Journal tab and read what MQL5's reference says it means. The codes traders search for most have a page with the cause and a fix.
Updated 22 October 2026. Runs in your browser; nothing you type is uploaded.
The number after retcode= in MT5's Experts or Journal tab. 41 codes, as MQL5's reference words them.
41 codes match.
10004TRADE_RETCODE_REQUOTERequote
Cause and fix10006TRADE_RETCODE_REJECTRequest rejected
Cause and fix10007TRADE_RETCODE_CANCELRequest canceled by trader
10008TRADE_RETCODE_PLACEDOrder placed
10009TRADE_RETCODE_DONERequest completed
Cause and fix10010TRADE_RETCODE_DONE_PARTIALOnly part of the request was completed
10011TRADE_RETCODE_ERRORRequest processing error
10012TRADE_RETCODE_TIMEOUTRequest canceled by timeout
10013TRADE_RETCODE_INVALIDInvalid request
Cause and fix10014TRADE_RETCODE_INVALID_VOLUMEInvalid volume in the request
Cause and fix10015TRADE_RETCODE_INVALID_PRICEInvalid price in the request
Cause and fix10016TRADE_RETCODE_INVALID_STOPSInvalid stops in the request
Cause and fix10017TRADE_RETCODE_TRADE_DISABLEDTrade is disabled
Cause and fix10018TRADE_RETCODE_MARKET_CLOSEDMarket is closed
Cause and fix10019TRADE_RETCODE_NO_MONEYThere is not enough money to complete the request
Cause and fix10020TRADE_RETCODE_PRICE_CHANGEDPrices changed
10021TRADE_RETCODE_PRICE_OFFThere are no quotes to process the request
Cause and fix10022TRADE_RETCODE_INVALID_EXPIRATIONInvalid order expiration date in the request
Cause and fix10023TRADE_RETCODE_ORDER_CHANGEDOrder state changed
10024TRADE_RETCODE_TOO_MANY_REQUESTSToo frequent requests
10025TRADE_RETCODE_NO_CHANGESNo changes in request
10026TRADE_RETCODE_SERVER_DISABLES_ATAutotrading disabled by server
Cause and fix10027TRADE_RETCODE_CLIENT_DISABLES_ATAutotrading disabled by client terminal
Cause and fix10028TRADE_RETCODE_LOCKEDRequest locked for processing
10029TRADE_RETCODE_FROZENOrder or position frozen
10030TRADE_RETCODE_INVALID_FILLInvalid order filling type
Cause and fix10031TRADE_RETCODE_CONNECTIONNo connection with the trade server
Cause and fix10032TRADE_RETCODE_ONLY_REALOperation is allowed only for live accounts
10033TRADE_RETCODE_LIMIT_ORDERSThe number of pending orders has reached the limit
10034TRADE_RETCODE_LIMIT_VOLUMEThe volume of orders and positions for the symbol has reached the limit
10035TRADE_RETCODE_INVALID_ORDERIncorrect or prohibited order type
10036TRADE_RETCODE_POSITION_CLOSEDPosition with the specified POSITION_IDENTIFIER has already been closed
10038TRADE_RETCODE_INVALID_CLOSE_VOLUMEA close volume exceeds the current position volume
10039TRADE_RETCODE_CLOSE_ORDER_EXISTA close order already exists for a specified position. This may happen when working in the hedging system: when attempting to close a position with an opposite one, while close orders for the position already exist when attempting to fully or partially close a position if the total volume of the already present close orders and the newly placed one exceeds the current position volume
10040TRADE_RETCODE_LIMIT_POSITIONSThe number of open positions simultaneously present on an account can be limited by the server settings. After a limit is reached, the server returns the TRADE_RETCODE_LIMIT_POSITIONS error when attempting to place an order. The limitation operates differently depending on the position accounting type: Netting — number of open positions is considered. When a limit is reached, the platform does not let placing new orders whose execution may increase the number of open positions. In fact, the platform allows placing orders only for the symbols that already have open positions. The current pending orders are not considered since their execution may lead to changes in the current positions but it cannot increase their number. Hedging — pending orders are considered together with open positions, since a pending order activation always leads to opening a new position. When a limit is reached, the platform does not allow placing both new market orders for opening positions and pending orders.
10041TRADE_RETCODE_REJECT_CANCELThe pending order activation request is rejected, the order is canceled
10042TRADE_RETCODE_LONG_ONLYThe request is rejected, because the "Only long positions are allowed" rule is set for the symbol (POSITION_TYPE_BUY)
10043TRADE_RETCODE_SHORT_ONLYThe request is rejected, because the "Only short positions are allowed" rule is set for the symbol (POSITION_TYPE_SELL)
10044TRADE_RETCODE_CLOSE_ONLYThe request is rejected, because the "Only position closing is allowed" rule is set for the symbol
Cause and fix10045TRADE_RETCODE_FIFO_CLOSEThe request is rejected, because "Position closing is allowed only by FIFO rule" flag is set for the trading account (ACCOUNT_FIFO_CLOSE=true)
10046TRADE_RETCODE_HEDGE_PROHIBITEDThe request is rejected, because the "Opposite positions on a single symbol are disabled" rule is set for the trading account. For example, if the account has a Buy position, then a user cannot open a Sell position or place a pending sell order. The rule is only applied to accounts with hedging accounting system (ACCOUNT_MARGIN_MODE=ACCOUNT_MARGIN_MODE_RETAIL_HEDGING).
Cause and fix
Return codes with a cause and a fix
10004RequoteTRADE_RETCODE_REQUOTE10006Request rejectedTRADE_RETCODE_REJECT10009Request completedTRADE_RETCODE_DONE10013Invalid requestTRADE_RETCODE_INVALID10014Invalid volume in the requestTRADE_RETCODE_INVALID_VOLUME10015Invalid price in the requestTRADE_RETCODE_INVALID_PRICE10016Invalid stops in the requestTRADE_RETCODE_INVALID_STOPS10017Trade is disabledTRADE_RETCODE_TRADE_DISABLED10018Market is closedTRADE_RETCODE_MARKET_CLOSED10019There is not enough money to complete the requestTRADE_RETCODE_NO_MONEY10021There are no quotes to process the requestTRADE_RETCODE_PRICE_OFF10022Invalid order expiration date in the requestTRADE_RETCODE_INVALID_EXPIRATION10026Autotrading disabled by serverTRADE_RETCODE_SERVER_DISABLES_AT10027Autotrading disabled by client terminalTRADE_RETCODE_CLIENT_DISABLES_AT10030Invalid order filling typeTRADE_RETCODE_INVALID_FILL10031No connection with the trade serverTRADE_RETCODE_CONNECTION
Every other code is in the lookup above, worded as in MQL5's table.
Read a whole MT5 EA's source
- MTR FullSystemEA (MQL5 source) The full MQL5 source of a production MT5 EA for XAUUSD M5 (hedge-grid and recovery): 21 files, 16,923 lines. $49 once.