MT5 return code 10008: Order placed (TRADE_RETCODE_PLACED)
MT5 return code 10008 is a success: the order was accepted and placed. Don't resend it, or you will place a second order.
What it means
You see this code in the retcode of a trade result, from OrderSend() in MQL5 or order_send() in Python.
10008 is a success code. The server accepted the order and it now exists. For a pending order, such as a buy limit, it waits in the order book until the price reaches it.
On some execution modes a market order also answers 10008 first and the deal follows a moment later. The order field of the result holds the new order ticket.
Common causes
- A pending order (limit, stop or stop limit) was accepted.
- A market order on an exchange-style symbol was placed and will fill shortly.
How to fix it
- Nothing to fix. Store
result.order, the ticket you will need to modify or delete it. - For a market order that answered 10008, read the position a moment later to see the fill price.
- Never treat 10008 as a failure and send again. That places a second order.
Example in Python:
import MetaTrader5 as mt5
tick = mt5.symbol_info_tick("EURUSD")
r = mt5.order_send({
"action": mt5.TRADE_ACTION_PENDING, "symbol": "EURUSD", "volume": 0.1,
"type": mt5.ORDER_TYPE_BUY_LIMIT, "price": round(tick.ask - 0.0050, 5),
"type_time": mt5.ORDER_TIME_GTC,
})
if r is not None and r.retcode == mt5.TRADE_RETCODE_PLACED:
print("pending order", r.order, "is waiting") Is it safe to retry?
No. It worked. Sending the same request again creates another order.
Could the order have executed?
Yes, the order exists. A pending order is waiting for its price; a market order that answered 10008 fills right after.
How Tickwire handles it
Tickwire counts 10008 as success and reports the outcome as applied. Your Idempotency-Key makes a retried call return this first result instead of a second order. See idempotency.
Related codes
- MT5 return code 10009: Request completed (TRADE_RETCODE_DONE)
- MT5 return code 10010: Only part of the request was completed (TRADE_RETCODE_DONE_PARTIAL)
- MT5 error 10022: Invalid expiration (TRADE_RETCODE_INVALID_EXPIRATION)
Related MT5 Python functions
One API for MT4 and MT5
Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.