1 year of history is expected behaviour for D1 and below.
Start your test sooner and code your EA to not "die".
Start your test sooner . . .
Oh, interesting!
I changed the start date to 1 day before, and I got:
2018.01.05 18:37:03.209 USDCHF,Daily: history cache allocated for 1565 bars and contains 389 bars from 2012.07.02 00:00 to 2013.12.30 00:00
Not that this will be my solution, but I do have a better sense of what's going on.
Thanks for the response.
Oh, interesting!
I changed the start date to 1 day before, and I got:
2018.01.05 18:37:03.209 USDCHF,Daily: history cache allocated for 1565 bars and contains 389 bars from 2012.07.02 00:00 to 2013.12.30 00:00
Not that this will be my solution, but I do have a better sense of what's going on.
Thanks for the response.
Seems "1 year" is very variable thing for Metaquotes :-D
The general solution is to start (320-259)= 61 days sooner so 2013.11.01. Arrived on 2014.01.01 you will have at least 320 bars in history and your real test can start.
I'm having same issue.
This is the log that I get when I run my EA on strategy tester.
2020.04.19 13:48:52.884 EURUSD,Weekly: history cache allocated for 70 bars and contains 53 bars from 2018.12.30 00:00 to 2019.12.29 00:00
I use some indicators on W1 timeframe with more than 53 as its period (example 100).
I'm not able to get indicator values until my W1 charts get at least 100 candle: it makes sense.
Is there no way to force MT5 to load more candle when test starts?
Only thing that can be done is start test X periods before in order to arrive at desired "start" point with enough bars loaded on chart?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In the back tester, I switched from H4 to D1, and the EA died.
So, I dug into the problem.
It turns out that I have an iMA I use for determining trend with a period of 320.
Granted that 320 hours is very different from 320 days, and I would likely scale this value back for logical considerations, I was curious about why the EA died.
It turns out BarsCalculated() continued to return -1.
Then I saw this in the "headers" for the test run:
Changing the iMA period to < 259 fixes the issue, no problem.
However, I am curious as to what is going on. As you can see, my test run goes from 2014.01.01 to 2017.12.31, which is four years, mas o menos. But the history cache is somehow a limitation.
So . . . what is the best way to handle this in the code?