Not enough bars for backtesing in MetaTrader4

I tried to test my strategy in the MT4 tester. My strategy requires some minimum amount of bars in the window. I downloaded the full archive so my usual trading windows have the full hystory and even the testing window seems have the full history. But when I insert a piece of the code into my advisor like Print (Bars), it shows me that the testing window has only few thousand bars. Why is the case? Thank in advance for any help.

First make sure you’ve set the needed number of bars in your history/chart here: MT4 >> Tools >> Options >> Charts tab.

Then downlowad that history in MT4 >> Tools >> History Center.

Yes, I did it, thank you. Downloaded the full history of quotes and set the required amounts in the both boxes. But it didn’t help. And I said both the trading window and the testing window reflect the full history of quotes, e.g. the testing windows reflects the history down to 1999.

But when I put into my expert the code like this:



Print (Bars);

  Print("Not enough bars");




it is reflected in the expert’s report tab like this:

2019.06.05 20:10:49.207	2019.06.04 23:59:12  kolm EURUSD,M15: Not enough bars

2019.06.05 20:10:49.207	2019.06.04 23:59:12  kolm EURUSD,M15: 28056

2019.06.05 20:10:49.207	2019.06.04 23:58:54  kolm EURUSD,M15: Not enough bars

2019.06.05 20:10:49.207	2019.06.04 23:58:54  kolm EURUSD,M15: 28056

Taking into account that it is a 15 min timeframe, and so with the the history down to 1999 it must contain about 500000 bars, 28056 as reflected in the expert is not evidently the correct number.

28056 is the number of bars from the initial date to the end date. So for a reason the expert just doesn’t the history before the initial date.

Did you restarted your MT4 terminal for these changes to take effect?

Try putting your history max bars settings to 1000000 or 10000000 and restart your platfom, then download the needed history from MT4 >> Tools >> History Center.

Solved, thank you. The solution was that at the beginning of testing the expert window just can’t contain more than 1000 bars, so I just have to start from an earlier date to allow the expert to reach the required initial point and accumulate enough history.