MT5 error 4754: Order not found (ERR_TRADE_ORDER_NOT_FOUND)
No pending order matches the ticket you named. It may have filled, expired or been deleted.
What it means
You see this code in GetLastError() in MQL5, after a function fails.
The terminal didn't find a pending order with that ticket. Pending orders leave the list when they trigger, expire or are deleted.
If it triggered, there is now a position or a deal instead.
Common causes
- The order filled when the price reached it.
- The order expired or was canceled by the broker.
- A position ticket used where an order ticket is needed.
How to fix it
- Check
OrderSelect(ticket); if it fails, look in history withHistoryOrderSelect(ticket). - If the order filled, find the position it opened.
Example in MQL5:
if(!OrderSelect(ticket))
{
HistorySelect(0, TimeCurrent());
if(HistoryOrderSelect(ticket))
Print("Order ", ticket, " is in history, state ",
EnumToString((ENUM_ORDER_STATE)HistoryOrderGetInteger(ticket, ORDER_STATE)));
} Is it safe to retry?
No. Check history first.
Could the order have executed?
Maybe. Your call did nothing, but the order itself may have filled, which is a common reason it is gone.
How Tickwire handles it
Tickwire looks the order up before sending a modify or delete. A missing order comes back as numericCode 4754 with nothing sent. Read routes answer order_not_found.
Related codes
- MT5 error 10023: Order state changed (TRADE_RETCODE_ORDER_CHANGED)
- MT5 error 4753: Position not found (ERR_TRADE_POSITION_NOT_FOUND)
- MT4 error 4108: Invalid ticket (ERR_INVALID_TICKET)
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.