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.

4754ERR_TRADE_ORDER_NOT_FOUND
NoSafe to retry?
MaybeCould it have executed?

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 with HistoryOrderSelect(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 MT5 Python functions

All MetaTrader error codes

One API for MT4 and MT5

Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.