MT5 error 4401: Requested history not found (ERR_HISTORY_NOT_FOUND)

The terminal has no price history for this symbol, timeframe or date range yet. Wait for it to download, or ask for a range it has.

4401ERR_HISTORY_NOT_FOUND
Yes, after a waitSafe to retry?
Not a tradeCould it have executed?

What it means

You see this code in GetLastError() in MQL5, after a function fails.

Charts and bar data are stored on the terminal. When you ask for bars it doesn't hold, the call can fail with 4401 while the terminal fetches them from the server.

It is common on the first request for a symbol or timeframe, and for dates far in the past.

Common causes

  • A first request for a symbol or timeframe the terminal has never loaded.
  • A date range older than the broker keeps.
  • A range limited by the terminal's "Max bars in chart" setting.
  • A symbol that isn't selected in Market Watch.

How to fix it

  • Retry after a short wait. The terminal loads history in the background.
  • Ask for fewer bars, or a more recent range.
  • Check SeriesInfoInteger(sym, tf, SERIES_SYNCHRONIZED) before reading.

Example in MQL5:

MqlRates rates[];
for(int attempt = 0; attempt < 10; attempt++)
{
   ResetLastError();
   int got = CopyRates(_Symbol, PERIOD_H1, 0, 500, rates);
   if(got > 0) { Print("got ", got, " bars"); break; }
   Print("no history yet, error ", GetLastError(), ", waiting");
   Sleep(500);
}

Is it safe to retry?

Yes, after a short wait for the history to load.

Could the order have executed?

Not a trade code. It is about data, not orders.

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.