Faster backtest with x second interval/timeframe

Have some interesting ideas about how to improve the software? Let us know in this section!

Faster backtest with x second interval/timeframe

Postby siolibros » Fri Jun 03, 2016 10:20 pm

hi guys
thanks for your website, very interesting

my name is paolo, and i'm an expert mt4 backtester (one of the first users of Birt method) and mt4 Expert Advisor developer

as i read in several EA reviews, and after several years of experience, i realized that good results with mt4 tick data backtest are not always easy to repeat again in real mt4 accounts
many mt4 brokers suffers of slippage, requotes, disconnection and so on... as most of you will know for sure

but these words are fortunately valid only for pip scalping or pip-hunting logics
i write this because, after a lot of job, i'm realizing good and steady results with grid trading systems with medium/large grid size. i refer to blessing EA and/or similar products

the problem of that systems is the large amount of parameters to optimize
i'm actually using a 40 computers server room... it's not a joke

well, i really think that such systems could be optimized with really fast backtest NOT using tick data (that are very very very slow)
actually i'm backtesting using open price only precision on m1 (using great HST files generated with tickstory full version)
unfortunately, m1 is too large time interval respect tick quality...
i think we all need an intermediate step
i'd like to backtest on mt4 using open price only method on SECONDS TIMEFRAMES, like S1,S5, S15, S30
i'm not a software programmer like you guys, but i think it should not be so complicated to modify your tickstory tool in order to create some additional HST timeframe based on seconds like S1,S5,S15,S30. the FTX will be automatically generated instead from mt4 engine

just imagine how much faster coulde be S5 (5 seconds) backtest on open price only compared with a tickdata backtest... and results will probably be really similar, if EA is not based only on pip hunting/scalping

actually, backtesting my personalized grid EA on 2 years tick data takes about 30 seconds (on interl core i7, with ssd disk)
the same EA, backtested on m1 openprice only takes only 1.5 seconds
with same identical results!!!!
but my EA has a lot of parameters to optimize...

unfortunately, the M1 timeframe is the real limit. 60 seconds interval is too much...

in practice, i'm suggesting to all traders interested in speed up their backtest optimization, to use open price method instead of tick data, but using 5 seconds precision (actually not available) - or 10/15/30 seconds
could tickstory developer team consider adding seconds timeframe HST files during "export to mt4" step?
i think that people only had to rename file after export... overwriting for example the m1 hst file... correct?

thanks for your help
i'm the same user previously named lukemp3 on this forum, but with new registration email
Posts: 11
Joined: Fri May 27, 2016 9:04 am

Re: Faster backtest with x second interval/timeframe

Postby tickstory » Wed Jun 08, 2016 6:47 am

Hello Paolo,

Thanks very much for your detailed email (we took some time to read it ;). From what I understand of the suggested change is that you would like Tickstory to export data in x second intervals rather than tick data. This sounds like a good idea. Bear in mind that, as you mentioned, Open price mode is much faster and is still possible to generate once you use Tickstory to create the HST files.

We would be interested to know if others would find this useful enough for us to implement as it would take some time to develop and test. It does seem that this is highly specialised for certain types EAs, however if other users give us some indication this would be useful we can look into it further.

Thanks again for your suggestion.
Posts: 2960
Joined: Sun Jan 06, 2013 12:27 am

Re: Faster backtest with x second interval/timeframe

Postby siolibros » Thu Jun 09, 2016 11:16 pm

hi guys
i prepared a short explanation video on youtube

in that video i show that, properly coded with open bar logic, most of EA (not scalpers) could work really faster on "open price only" model istead of slow "tick data" model
actual problem is that it's actually limited to M1 time resolution

i kindly ask to dev team to consider adding export to mt4 format with seconds timeframes too: s1,s5,s15,s30
the hst file should mantain the name of the minute format
in that case, a M5 backtest will produce a S5 backtest

it could totally change the way of backtesting/optimizing EAs in mt4, with amazing speed, allowing anyone to really go further... ;-))
Posts: 11
Joined: Fri May 27, 2016 9:04 am

Re: Faster backtest with x second interval/timeframe

Postby lukemp3 » Mon Jun 20, 2016 6:08 pm

Hi Paolo
I got your PM and I think it should a good idea to share this info to All Community :-))
We could all benefit from it, if Developer Team will add this <seconds feature> into the new update
I'm interested in.

Posts: 18
Joined: Wed Oct 30, 2013 11:15 am

Re: Faster backtest with x second interval/timeframe

Postby KirBiz » Mon Jun 20, 2016 7:47 pm

seconds TF will be very good option
Anyway eveyone will use it after comparing EA's test on tick mode.

Posts: 13
Joined: Sun Nov 29, 2015 5:59 pm

Re: Faster backtest with x second interval/timeframe

Postby Parkzo » Tue Jun 21, 2016 9:39 am


I am in the same situation, in that I have a grid EA that performs well but takes so long to optimise against its many parameters. It literally takes days.

Sounds like this would speed things up significantly and make my life much easier!

I'm very much in favour of this ability to test against seconds timeframes.

Posts: 18
Joined: Mon Jun 29, 2015 12:16 pm

Re: Faster backtest with x second interval/timeframe

Postby wemersonrv » Tue Jun 21, 2016 12:35 pm


I thing this is a good idea. I'm tired of doing really long tests. Tired of wainting for weeks and weeks for optimized testes with 2 years or more.

If your idea increase the time result, you have my support!
Posts: 24
Joined: Wed Nov 25, 2015 1:56 am

Re: Faster backtest with x second interval/timeframe

Postby radu » Wed Jun 22, 2016 9:13 am

Your idea is quite interesting, I'm using grid systems as well, so I'm interested. For grid systems, all tick vs. open prices could make a really big difference. It all depends on how much and which data (ticks) will be removed from the equasion. In your video, check the reports: Ticks modelled 47378401 vs. 1488015. One thing is for sure: ticks will be removed - and if those ticks originating from a big rally on the market - then for example the maximal drawdown will be different from the full tick version. In your youtube video, a minor difference only occurs in that value. The question is: which ticks will be removed? I know that MT4 handle which ticks will be excluded, so you have to trust on MT4's algorithm on this. I don't say this is bad, I'm just popping up a question.

Have you considered this possibility?

Of course, this could be acceptable if the speed will be much faster, yes.

Nevertheless, I'm willing to support your idea, but still interested in your reply.
Posts: 30
Joined: Tue Feb 12, 2013 8:35 am

Re: Faster backtest with x second interval/timeframe

Postby siolibros » Wed Jun 22, 2016 9:34 am

hi guys, thanks for your interested in my thread

the open price method, based actually only on M1, just uses one price every minute, totally ignoring all other ticks
that's the reason of the really different number of ticks modelled

but when i use full tick data, in my mql4 i force to use always the same opening price of a new bar (simulating the open price method also using tick data fxt)
so, even if number of ticks is greater, i'll only use one tick value for each minute

1488015 is about 30 times smaller than 47378401, but with almost identical results
it means that we were using 30 times bigger (and about 30 times slower) file for backtest... not needed!

the faster speed in backtest is totally due to this new approach
i limit usage of my EA only on the first tick of every minute to do all calculations, instead of each tick

i hope tickstory developer team will now consider my request... ;-))
Posts: 11
Joined: Fri May 27, 2016 9:04 am

Re: Faster backtest with x second interval/timeframe

Postby tickstory » Thu Jun 23, 2016 11:06 am

Hi all,

Looks like there's some interest in this topic. Siolibros, just bear in mind that, as Radu was pointing out, the affect on back-test results when using this sampling will largely be based on how the EA is coded. Results will vary and some EAs may not respond correctly to the filtering (e.g. see our discussion on Duplicate Ticks filter here: viewtopic.php?f=5&t=66).

With that in mind, here are some possible implementations of this algorithm:

- "Maxmum of x ticks per minute." Whenever x consecutive ticks occurred, all the remaining ticks would be suppressed for that minute. (Potential for missing large price moves)
- "One tick sample per x seconds." That is, no two consecutive ticks would occur less than x seconds between each-other in the one minute bar. If no tick occurred in a whole minute, there would be a doji would be created based on the last recorded price from the previous minute bar (?).
- "Only record a tick in a single minute if it's price is greater than x%".

I imagine each would have its pros and cons for each type of EA. We're obviously interested in the one that most EAs would benefit from.

Some sort of consensus would be good although we'd need to assess difficulty from a development point of view (the first option may be the simplest). Also, the more complex the routine, the harder it often is to determine what effects it may have on any particular strategy.

Posts: 2960
Joined: Sun Jan 06, 2013 12:27 am


Return to New features & suggestions

Who is online

Users browsing this forum: No registered users and 2 guests