Very strange - Error 4074 - out of memory when using iTime for multi timeframe functionality?

 

I am working on an EA in MT4, trying to take advantage of some multi-timeframe features.  In summary, my current EA runs on a PERIOD_D1 tf and I want to check the current time on PERIOD_D1 tf to manage housekeeping functionality.

To isolate the problem I made the following toy EA.  This is all that is in my "iTimeTest.mq4" file:

void OnTick() {
   ResetLastError();
   datetime itime_test = iTime("EURGBP", PERIOD_M1, 0);
   int err = GetLastError();
   Print("iTime(\"EURGBP\", PERIOD_M1, 0): ", TimeToString(itime_test, TIME_DATE|TIME_SECONDS), " error: ", err);
  }

Attaching it to a chart directly "live" it acts as expected, an example from a successful log entry.  I have an actual time value and no error:

0       13:49:30.033    Expert iTimeTestEA EURGBP,Daily: loaded successfully
0       13:49:31.803    iTimeTestEA EURGBP,Daily: initialized
0       13:49:31.889    iTimeTestEA EURGBP,Daily: iTime("EURGBP", PERIOD_M1, 0): 2023.01.13 20:49:00 error: 0

But, when run in the strategy tester it does not read the time correctly, instead returns 1970.01.01 00:00:00, and shows the error 4074:

4074

ERR_NO_MEMORY_FOR_HISTORY

No memory for history data

0       13:40:27.024    Expert iTimeTestEA EURGBP,Daily: loaded successfully
0       13:40:29.132    TestGenerator: spread set to 2
2       13:40:35.564    2018.01.01 00:00:00  iTimeTestEA test started
0       13:40:35.570    2018.01.02 00:00:00  iTimeTestEA EURGBP,Daily: iTime("EURGBP", PERIOD_M1, 0): 1970.01.01 00:00:00 error: 4074

I have a metric tonne of memory on my workstation (128 GB RAM), and as I run the tests above with Windows, Outlook, MT4 + MT5 and Chrome I am only using 13 GB of it.  So this error cannot truly be due to the memory available to the app via RAM.

I have restarted the PC, and of course restarted MT4 multiple times.

I am being careful to only select the same symbol for both the EA and the symbol in the strategy tester to eliminate accidental "multi-symbol testing" as a source of the problem.  The data provider is OANDA, just using a vanilla DEMO account.  This issue does not come up in MT5.

Can anyone else replicate the above?

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
What are the differences between the three modes of testing in MetaTrader 5, and what should be particularly looked for? How does the testing of an EA, trading simultaneously on multiple instruments, take place? When and how are the indicator values calculated during testing, and how are the events handled? How to synchronize the bars from different instruments during testing in an "open prices only" mode? This article aims to provide answers to these and many other questions.
 
Do you have over 5 years of M1 history?
 
Keith Watford #:
Do you have over 5 years of M1 history?

Ah... I would have expected a different error code such as

4073

ERR_NO_HISTORY_DATA

No history data

not "no memory for history" - but there you go, thanks for the heads up.  I changed the date range in testing to be within only a couple days and that worked


Thanks!