MT5 Tester: history cache build error - page 2

 
Alain Verleyen:

An ex5 is of no help.

A log would maybe provide some useful information.

Otherwise there is only one thing to do, isolate the minimal code to reproduce the issue.

There is no useful information anywhere about this "history cache build error".

An idea but I don't see how it would be related, but who knows. Are you using "#property tester_everytick_calculate" in your code ? If not try to add it.

Thank you for your reply Alain,

Tried the property, didn't help - also, I have previously commented out the section where I call Create() on the indicator wrappers (all of them are wrapped in objects from include/Indicators), didn't help either.

I guess you are right, I will have to strip it down to a minimal portion of code reproducing the issue. 

Ugh, going to be tedious :(

Here's the log, I can't spot anything useful, unfortunately:

Files:
 

Actually, thanks for everyone's help, I found at least one culprit: in my code I was trying to be smart and skip ticks where they didn't require processing.

The code looked like this:

      if(skipTicksLastBarTime < iTime(symbolInfo.symbol, (ENUM_TIMEFRAMES)skipTicksTF, 0)
      || lastBarTimeOpen < iTime(symbolInfo.symbol, (ENUM_TIMEFRAMES)openTF, 0)
      || lastBarTimeClose < iTime(symbolInfo.symbol, (ENUM_TIMEFRAMES)closeTF, 0)) {
         skipTicksLastBarTime = iTime(symbolInfo.symbol, (ENUM_TIMEFRAMES)skipTicksTF, 0);
        //do the useful stuff here
      }

Turned out one of the TF variables was not initialized. 

MT4 lets it pass somehow, but MT5 doesn't.


Took me few hours of stripping the code off before I got it.

It would have helped if MT has logged that I'm requesting negative timeframe ;)

 

In addition to that, I was loading the value for ENUM_APPLIED_PRICE from the set that was saved in MT4.

Any example of PRICE_CLOSE (which is = 0 in MT4) was obviously invalid in MT5.

Another one down.

 

Same thing happened to me when I tried testing my EA with historical data from a week ago. It seems only a specific asset produces the issue. Problem is, I've developed this EA on MetaTrader 5 from the beginning and it worked before. Plus I don't recall using any non-initialized variables. Well, I've got some work to do, stripping down 4000 lines of code (not counting several .mqh files) to a bare minimum...

Edit: it seems the problem in my case was simply the lack of historical data on the cloud servers. Strange...

 

I fell on this problem.

I solved it by changing the period, my EA was computing periods from input parameters, maybe it ouput an inexisting period.