Page 1 of 1

Very slow backtest speed

Posted: Sat Jan 01, 2022 11:09 am
by tctrading
the backtests with the ticks downloaded on the platform are incredibly slow and unsustainable. :( maybe i am doing something wrong? i have tried with 2 different brokers. how can i solve this? When I do the backtest without tickstory (with the broker's data) everything runs very fast. Can you help me please?

Re: Very slow backtest speed

Posted: Sat Jan 01, 2022 11:59 pm
by tickstory
Hi Tctrading,

Slower back-test speeds are the trade-off of using quality tick data. When you are back-testing with your broker data, you are doing around 4 calculations per bar - one for open price, high, low and close. In comparison, you could be processing many hundreds of ticks for that same period with tick data. There is no comparison between the accuracy of the test results you will get between OHLC and tick data because tick data is more accurately simulating real market conditions. Tick data will therefore give you a much better understanding of your strategy. In most cases, MT4 broker data is notoriously inaccurate and will not give you any real insight into how your strategy will perform in live trading. It is only there to give you a very rough idea of how your EA is functioning and for fixing bugs.

All said, if you wish to speed things up, here are a few considerations for you (in order of ease to implement):

- You can marginally improve speed by clicking on the "Remove duplicate ticks" check-box when exporting from Tickstory. This will filter any consecutive price ticks that are the same.

- Can you do a rudimentary test of your EA in say 'OHLC' or 'Open price' mode to get an understanding of its performance? If yes, then you could have a testing approach whereby you perform the rudimentary test and then use tick data tests on only the promising candidates. If your EA is a scalper, however, you are usually confined to using tick data to get accurate results. Testing scalpers with MT4 broker/1-minute data is unfortunately entirely worthless due to the fact they depend on small price movements that only possible to simulate with tick data.

- You can try break your back-tests into smaller portions - say 6 months - to get an idea of how your EA is performing. Then, perform longer back-tests on candidates that show the strongest performance.

- You should optimize your EA to understand what might by taking a long time to process each tick. If there is lots of information being posted to the Journal, for example, this will likely slow things down. Similarly, if you have heavy duty calculations that only need to be done every say x ticks, you can change your code accordingly and this can markedly improve the processing times.

- Consider your machines' performance. If you have a machine with lower specification (CPU/memory, etc) or it is processing other applications at the same time, this will affect how long your tests take to complete.


Hope this helps.