MT5 error 10028: Request locked for processing (TRADE_RETCODE_LOCKED)
The request is locked while the server processes it. The final result is not known yet, so check the account before sending anything again.
What it means
You see this code in the retcode of a trade result, from OrderSend() in MQL5 or order_send() in Python.
10028 says the request, or the order it refers to, is busy being processed. You don't have a final answer yet.
Because processing is under way, the trade may complete after this answer.
Common causes
- A request that touches an order already being handled.
- Slow processing on the broker's side.
- Two requests for the same order sent close together.
How to fix it
- Wait a moment, then read orders, positions and deals to see the real state.
- Don't send a second request for the same order while the first is in flight.
Example in Python:
import MetaTrader5 as mt5
from datetime import datetime, timedelta
TAG = "job-4711" # your own id for this order, also sent as the comment
MAGIC = 4711
def find_my_order(symbol):
"""Look for the effect of an order whose answer was unclear."""
for p in mt5.positions_get(symbol=symbol) or ():
if p.magic == MAGIC and p.comment == TAG:
return "position", p.ticket
for o in mt5.orders_get(symbol=symbol) or ():
if o.magic == MAGIC and o.comment == TAG:
return "pending order", o.ticket
# Server time is not UTC, so search a wide window.
now = datetime.now()
deals = mt5.history_deals_get(now - timedelta(days=1), now + timedelta(days=1)) or ()
for d in deals:
if d.magic == MAGIC and d.comment == TAG:
return "deal", d.ticket
return None, None
r = mt5.order_send(request)
if r is not None and r.retcode == mt5.TRADE_RETCODE_LOCKED:
kind, ticket = find_my_order(request["symbol"])
print("found" if kind else "nothing found yet", kind, ticket) Is it safe to retry?
Only after checking the account. The first request may still complete.
Could the order have executed?
Maybe. Processing was under way when the answer came.
How Tickwire handles it
Tickwire treats 10028 like a lost connection: no new exposure is sent, it looks for the effect and reports applied, rejected or unknown. See idempotency.
Related codes
One API for MT4 and MT5
Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.