Download MetaTrader 5

backtesting over long periods of time in MT4

To add comments, please log in or register

Hi all,

I'm reposting my question in this forum since it's MT4 related. Previous post can be found:

On topic now:

When i do a back-testing over a long period of time (begin 2000 to end 2014), the back-tester stops half 2013 and is therefore not doing a test over the full period of time.
It seems that when the file size of the tick history is bigger than 4GB, the tester stops and is thus causing this issue.

Currently, as workaround, i check where the tester stopped and continue with a new test starting from the period where the previous one ended. The ending of the test has also nothing to do with a stop-out or something like that.

So, I was wondering if some of you guys are also experiencing this behavior? Are there people around here who are also doing backtesting over longer time periods?
If yes, how do you process backtesting over long periods of time ?

Thanks in advance.




yes, if you are using "Every Tick" mode and the FXT file becomes to big (> 4GB), the backtest will just stop. Welcome to the great world of MT4 ! ;) A program that has got no major revision since 14 years, not able to use multithreading of modern processors, not 64bit and hence can´t use more than 2GB of RAM for it´s own process and can´t handle files beyond 4GB at all. Great, isn´t it? All the latest upgrades they are doing are to make more money for them and their brokers. And their latest great MT5, which can indeed use multithreading, doesn´t allow you to use your own data for backtesting and you have to rely on the crappy and full of holes data that they supply which makes backtesting any system pretty useless - no, thank you MQ!


Now that being said, you have to work around these stupid limitations. I for one use Bar Open mode only for backtesting and adjust the EA to also trade only on Bar Open for live-trading (SL / TP are still triggered intrabar, also during the Bar Open mode backtest). With that approach, my backtests and live-trading match near 99% so far since 1,5 years of live trading. For the EA to trade on bar open only you use this code:

int    IsBarStart;
int    nBars;


    IsBarStart = 0;
    if (nBars != Time[0])
        IsBarStart = 1;
        nBars      = Time[0];

 Then, for any operation that opens a trade or modifies a trade (also important to not forget such operations), you just do:


if (IsBarStart == 1)


your code.... 


This is a good solution since the "every tick" mode of MT4 anyway does create very unreliable backtesting results since the ticks are just synthetical generated and do not match what you will get during live trading. With my above approach, as said, I have a 99% match for the last 1,5 years of live trading to the backtests I get with the Bar Open mode.


The only way around the limitation and the 4GB limit as well as to get accurate tick-data backtests, is to use Birt´s Tick Data Suite (see Google). But the backtests do takes AGES of course. 


Good luck 


Hi mt4user2000,

Thanks for your feedback.

To add comments, please log in or register