MT5 Error 10012: How to Check a Timed-Out Trade Request
MT5 trade server code 10012 (TRADE_RETCODE_TIMEOUT) reports that a request was canceled due to a timeout. Use the code to identify the affected request, then reconcile it against order and deal records before deciding whether any further action is appropriate. MetaQuotes defines the return code without specifying a root cause or a retry interval.
Steps to check
- Start with the existing Journal or EA log entry. Record the action (place, modify, cancel or close), exact broker symbol including any suffix, direction and requested volume where applicable, and the recorded time and clock basis. Keep the target order or position reference for a modification or close. In an EA log, look for 10012 in MqlTradeResult.retcode. An application timer or a generic disconnect message can describe a different event. Save the order or deal ticket when populated.
- Use records for the same trading context and a window spanning submission through the latest observed state. Align the log clock with the broker's server clock before comparing timestamps. In MQL5, HistorySelect uses server time and has a success return value. Treat a failed history selection or a truncated export as a gap in coverage. Active orders — Whether the matched order is still working and how much volume remains. Historical orders — The state and timestamps for the exact order ticket. Deals — The executed volume associated with that order. Keep each deal ticket and check for more than one fill. Positions — Whether the relevant exposure or protection changed. For a modification, compare the recorded setting with the requested value and look for later changes. Use order and deal references for the match. Symbol, side, volume and time help narrow the search when a reference is missing. Treat a match based on those details alone as provisional, especially if multiple orders share them.
- Use the terminal-assigned request_id to correlate the dispatch with its request callback in the same session. In OnTradeTransaction, read the request and result parameters for TRADE_TRANSACTION_REQUEST. Use order and deal identifiers for their own transaction records. MT5 can emit several events for a request, and their arrival order can vary. Build the timeline from identifiers and recorded times.
- Canceled without a recorded fill. The matched historical order is final and canceled, the active-order snapshot shows no matching working order, and complete deal records for its lifetime show no matched executions. Reassess current conditions independently before considering a fresh request. Execution recorded. A matched deal establishes executed volume. Check the remaining quantity and whether an order is still working, including when an order's final state is canceled. Order still working. Record the remaining quantity and snapshot time. Keep the final outcome open. Unresolved. Identifiers are missing, the time window is incomplete, or records disagree. Preserve what you can match and ask the broker to reconcile the specific request if the discrepancy persists.
Worked example
These are fictional demo records. All times in the table use the same broker server clock. 09:41:00 — EA log records a pending buy request for 0.10 lots of XAUUSD. The existing log trail associates it with order A. 09:41:03 — The dispatch's request callback records retcode 10012. 09:41:04 — Order history records order A as canceled. 09:41:06 — Deal D records a 0.10-lot XAUUSD buy linked to order B. 09:42:00 — The active snapshot has no order A. The complete deal export for A's lifetime contains no deal linked to A. The result for A is canceled without a recorded fill. Deal D belongs to B even though its symbol, side and size match. If the deal export stopped at 09:41:02, the cancellation would still be recorded, but whether A had any execution would remain unresolved until the missing interval was reconciled. If the request started with an XAUUSD signal, use the signal date and reference to look up its recorded outcome separately. Keep the signal record and the broker execution record side by side when comparing results.
Frequently asked questions
Is 10012 the same as an MT5 connection error?
10012 reports a timeout cancellation. Code 10031 reports that there was no connection to the trade server. Use the actual return code to choose the investigation.
Can I identify the request by its time and symbol alone?
Use those details to find candidate records. An exact order or deal reference gives you a stronger basis for attribution when similarly sized orders share the same time window. Keep the outcome unresolved if you cannot distinguish the candidates.
Does 10012 tell me how long to wait before retrying?
The return-code reference gives no retry interval. Confirm the matched order state and any executed volume first. Where records are incomplete, the outstanding question is what happened to the original request.
Related guides
Related video
Related video: how an MT5 automated setup sends orders