Faster backtest with x second interval/timeframe

Have some interesting ideas about how to improve the software? Let us know in this section!
4EverMaAT
Posts: 29
Joined: Mon Jan 20, 2014 3:55 pm

Re: Faster backtest with x second interval/timeframe

Post by 4EverMaAT »

I would love to see something like this as I agree that the backtests (for grids or any strategy that needs smaller than 1 min granularity) that 1 - 5 second granularity would be a great compromise.

But remember, it is originally a mt4 limitation (not allowing seconds chart timeframes), so we are creating these weird workarounds.

radu
Posts: 30
Joined: Tue Feb 12, 2013 8:35 am

Re: Faster backtest with x second interval/timeframe

Post by radu »

I reply to each idea in details, trying to pointing out their concern on the strategies.
tickstory wrote: - "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)
This could be good, but very confusing. If this will be a feature, it has to be communicated clearly in order to avoided by those who won't need this. General idea: in TSL, every option (mostly on "Metatrader info" tab) there should be az instant tooltip with the meaning of each option. Those would be helpful.
tickstory wrote: - "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 (?).
I don't like this one; from the three options, this could generate the utmost distortion of results.
tickstory wrote: - "Only record a tick in a single minute if it's price is greater than x%".
This option also could create distortion and finding out the "right" percentage is a pretty hard task.

Option 4, by radu (mostly for open-price and grid strategies):
Maximized count of ticks per candle, with a same algorithm that MT4 uses (Does anybody know what the formula is, or we have to create one?). We have Dukascopy tick data, so we know the real tick's inciming order; so with a creation of algorithm we could use it to reduce tick count with the ability to keep events as close to the reality as possible.

With this solution we don't have to create new (artificial) timeframes. It should be understood that the result won't be (couldn't be) the same as in the full tick backtests, if they do, that's just pure luck and/or coincidence.

For grid systems the two most important things are:

- where to (in which price) open trades;
- experiencing floating and equity changes as accurately as possible (higher p'n'l values are the better; no dreams needed!).

As far as I know (and experienced) the orders (BUY STOP, SELL STOP, BUY LIMIT, SELL LIMIT) will open in their initially set price even if there were no price (tick) - so when a strategy (grid or not grid) using STOP/LIMIT orders, the MT4 backtester is "naturally" cheating (with or without TSL). So with this solution, STOP/LIMIT orders won't be suffering from missed prices. That's because the ticks will be based on H-L values, so they could be fullfilled even with missed ticks. (This is the basic behavior of MT4; if the price is at 1.00500, you place a BUY STOP to 1.00600 and the next tick after 1.00500 is 1.00670, the order will be opened at 1.0060 - it's original price.)

Market orders however will be experience the missed ticks, and this will cause different result unavoidably. This has to be accepted by the user, in favour of quicker backtest.

Other, tick-based strategies - scalping, trend strategies, etc. - should not use these "quicker backtest" option, because for them the missed ticks mode will hijack the results (even to positive or negative direction).

Of course, all of the above is just a point of view, I'm very interested hearing all of your opinions.

siolibros
Posts: 13
Joined: Fri May 27, 2016 9:04 am

Re: Faster backtest with x second interval/timeframe

Post by siolibros »

hi guys
thanks for all your interest about my original request for seconds timeframes support in tickstory
we all love tickstory, for its ability to let us doing backtest with 99,9% real tick quality data
in this post i would like to explain in detail some points to everyone, because the final solution is more simple than ever

when we prepare a M5 timeframe backtest, tickstory will create a M5 HST file, and the related FXT file
the HST file will contain only M5 bars data, the FXT file will contain tick data
instead, if we prepare a H1 timeframe backtest, tickstory will create a H1 HST file, and the related FXT file
this time the HST file will contain only H1 bars data, the FXT file will contain the same previous tick data
well, the FXT file will be always the same for each timeframe prepared. it has the same file size and content for every timeframe created
so, when creating different timeframes backtest files, the only differences are in the HST files
it should be clear to everyone with some experience about

unfortunately for all, backtest on tick data are really too slow, for anyone that's interested in doing a serious backtest optimization with dozens of variables
after some months of annoying test, i finally found a really good way to increase dramatically backtest speed (to be used on massive optimization)
the secret is changing a little the mql4 code of our expert advisors, starting to work only on open bar prices
i found a way to let ANY mql4 code to use only open bar price method
it's very simple

1) this is a standard mql4 EA code:

void OnTick()
{
if (count>10)
ExpertRemove();
Print("TIME: ",TimeCurrent());
count++;
}

this simple EA will print 10 consecutive ticks data

2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:03
2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:03
2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:02
2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:02
2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:01
2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:01
2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:01
2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:00
2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:00
2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:00
2016.06.25 12:15:22.090 2016.03.01 00:00 aaa EURUSD.,M1: TIME: 2016.03.01 00:00:00

please note that we have some doubled lines
it means that there were more than one tick in the same second, it's normal


2) this is the modified version working only on new bar price, depending on the timeframe used
just suppose using M1 data

void OnTick()
{
if (Time0 != Time[0])
{
Time0 = Time[0];
if (count>10)
ExpertRemove();
Print("TIME: ",TimeCurrent());
count++;
}
}

this simple EA will print 10 consecutive open price values, with 1 minute interval

2016.06.25 12:15:45.638 2016.03.01 00:10 bbb EURUSD.,M1: TIME: 2016.03.01 00:10:00
2016.06.25 12:15:45.638 2016.03.01 00:09 bbb EURUSD.,M1: TIME: 2016.03.01 00:09:00
2016.06.25 12:15:45.638 2016.03.01 00:08 bbb EURUSD.,M1: TIME: 2016.03.01 00:08:00
2016.06.25 12:15:45.638 2016.03.01 00:07 bbb EURUSD.,M1: TIME: 2016.03.01 00:07:00
2016.06.25 12:15:45.638 2016.03.01 00:06 bbb EURUSD.,M1: TIME: 2016.03.01 00:06:00
2016.06.25 12:15:45.638 2016.03.01 00:05 bbb EURUSD.,M1: TIME: 2016.03.01 00:05:00
2016.06.25 12:15:45.638 2016.03.01 00:04 bbb EURUSD.,M1: TIME: 2016.03.01 00:04:00
2016.06.25 12:15:45.638 2016.03.01 00:03 bbb EURUSD.,M1: TIME: 2016.03.01 00:03:00
2016.06.25 12:15:45.638 2016.03.01 00:02 bbb EURUSD.,M1: TIME: 2016.03.01 00:02:00
2016.06.25 12:15:45.638 2016.03.01 00:01 bbb EURUSD.,M1: TIME: 2016.03.01 00:01:00
2016.06.25 12:15:45.638 2016.03.01 00:00 bbb EURUSD.,M1: TIME: 2016.03.01 00:00:00

please note the 1 minute difference for each row

both backtests were executed on "every tick" mode, on hst and fxt files produced with tickstory with 99,9% quality
it means that it's really slow, due to the big size of the FXT file (about 4GB for 4 years of eurusd tick data)
but if we decide to use the new given mql4 code, tick data are not necessary
now that our new code just uses only new bar prices, we could move to backtest using "open price only" method, mantaining same results!
what does it means? it means that we won't use the tickstory FXT file, because a new one will be created directly from mt4 terminal
but we will get same results, look here!!!
same EA, using original HST file from tickstory and a NEW AUTOGENERATED on-the-fly FXT file from MT4

2016.06.25 12:18:26.305 2016.03.01 00:10 bbb EURUSD.,M1: TIME: 2016.03.01 00:10:00
2016.06.25 12:18:26.305 2016.03.01 00:09 bbb EURUSD.,M1: TIME: 2016.03.01 00:09:00
2016.06.25 12:18:26.305 2016.03.01 00:08 bbb EURUSD.,M1: TIME: 2016.03.01 00:08:00
2016.06.25 12:18:26.305 2016.03.01 00:07 bbb EURUSD.,M1: TIME: 2016.03.01 00:07:00
2016.06.25 12:18:26.305 2016.03.01 00:06 bbb EURUSD.,M1: TIME: 2016.03.01 00:06:00
2016.06.25 12:18:26.305 2016.03.01 00:05 bbb EURUSD.,M1: TIME: 2016.03.01 00:05:00
2016.06.25 12:18:26.305 2016.03.01 00:04 bbb EURUSD.,M1: TIME: 2016.03.01 00:04:00
2016.06.25 12:18:26.305 2016.03.01 00:03 bbb EURUSD.,M1: TIME: 2016.03.01 00:03:00
2016.06.25 12:18:26.305 2016.03.01 00:02 bbb EURUSD.,M1: TIME: 2016.03.01 00:02:00
2016.06.25 12:18:26.305 2016.03.01 00:01 bbb EURUSD.,M1: TIME: 2016.03.01 00:01:00
2016.06.25 12:18:26.305 2016.03.01 00:00 bbb EURUSD.,M1: TIME: 2016.03.01 00:00:00

these results are identical to the previous one, but it's obtained using "open price only" method, that uses HST from tickstory and a new FXT generated from mt4
the difference is passing from 4GB FXT file to about 150MB FXT file (referring to about 4 years data range of eurusd)
the new FXT file is really faster to use for backtest, about 30X times!!!

in order to be 100% sure that prices obtained with open price bar method are identical to every tick method, i developed another simple mql4 code that let me count the number of total bars and the sum of all prices of each bar
i backtested this EA with "every tick" method, with these results

2016.06.26 15:32:35.656 EURUSD.,M1: 71417401 tick events (1272564 bars, 71513119 bar states) processed in 0:00:21.263 (total time 0:00:21.372)
2016.06.26 15:32:35.656 2016.05.31 23:59 ContaBarre2 EURUSD.,M1: LAST DATE: 2016.05.31 23:59:59
2016.06.26 15:32:35.656 2016.05.31 23:59 ContaBarre2 EURUSD.,M1: PriceSum: 1573998.70589
2016.06.26 15:32:35.656 2016.05.31 23:59 ContaBarre2 EURUSD.,M1: BarsCount: 1271004
2016.06.26 15:32:14.386 2013.01.02 00:00 ContaBarre2 EURUSD.,M1: FIRST DATE: 2013.01.02 00:00:04

please consider the 21 seconds to elaborate...

now the same EA with "open price only" method (that use HST from tickstory and FXT generated onthefly from mt4)

2016.06.26 15:34:18.636 EURUSD.,M1: 1271006 tick events (1271126 bars, 2536238 bar states) processed in 0:00:00.514 (total time 0:00:00.592)
2016.06.26 15:34:18.636 2016.05.31 23:59 ContaBarre2 EURUSD.,M1: LAST DATE: 2016.05.31 23:59:59
2016.06.26 15:34:18.636 2016.05.31 23:59 ContaBarre2 EURUSD.,M1: PriceSum: 1573998.70589
2016.06.26 15:34:18.636 2016.05.31 23:59 ContaBarre2 EURUSD.,M1: BarsCount: 1271004
2016.06.26 15:34:18.116 2013.01.02 00:00 ContaBarre2 EURUSD.,M1: FIRST DATE: 2013.01.02 00:00:00

see the amazing 0.592 seconds to elaborate... 40X times faster!!! and the same identical results!! same number of bars, same total of the sum of all prices

with this last demonstration, i'm showing you all that we have a totally new way to seriously increase our backtest speed

the only actual limitation is the M1 timeframe
i'm not so happy to limit elaboration of my EA just one time every 1 minute, even if it works well
i'd like to use the same method to work on seconds timeframes, just to fill the gap between tick data and M1 data

i really don't understand previous posts about which method to use to create new files for backtest
we don't need tickstory to create FXT file for my suggested method!!!
so any effort to decide which method to use for creating FXT files is unuseful

we just need to use HST file, but with new seconds timeframes
MT4 will generate onthefly the related FXT file
little tip: after MT4 created the FXT file, i suggest you to make it "read only" to prevent overwriting each time, to save additional time

about passing from backtest on seconds timeframes to live trading with seconds timeframes charts:
there are already a lot of tools that let mt4 traders to trade on seconds charts
just google "mt4 custom timeframes" to find solutions
the best one is probably "fx blue tick range and renko charts for mt4": a free tool that let trades create onthefly seconds charts in mt4
but it does nothing for backtest...
the problem till today is that it's still not possible to backtest on seconds timeframes

due to the new approach i'm suggesting and sharing with everyone, i strongly suggest to do by yourself some test with new method, actually on M1 timeframe
my original grid system EA was programmed to work on standard tick loop only (as 99% of MT4 EAs)
but probably tick data precision was not stricly necessary
after little code modification (explained above), it still works great on open bar price
the same thing could really happen with yours EAs
i suggest to test this method on your EAs code guys

in the meantime, i hope that tickstory dev team will add support for creating HST seconds timeframes
i think it should be really easy, because you already have the full code to creat M1,M5,M15.... and so on
don't waste time about FXT tick data: we don't need them!

we (me and my brother) propose to tickstory to become beta-testers about this new feature. we've several computers (over 40) ready to start testing and comparison to get quickly the stable version
we will test the new version on different timeframes and pairs, to see if all is working properly

tickstory
Posts: 4883
Joined: Sun Jan 06, 2013 12:27 am

Re: Faster backtest with x second interval/timeframe

Post by tickstory »

Hi Solibros,

Thanks for the input, although I think you might need to check a few things:

1) Your code that filters ticks (based on the current bar's Time[0]) will filter all ticks until the next bar in that timeframe. In M1, it may have the effect you would like, however try it in M5 - it will only process the open price of every 5-minute bar which is not very effective and, if suitable for your purposes, defeats the the need for using tick data altogether.
2) If you decide to use 'Open price' mode and get MT4 to generate the FXT file, then you again are going to have similar behaviour described above. In M5 timeframe, the FXT file will sample the open price at the start of every 5-minute bar. Again, this is standard MT4 behaviour and will not produce an accurate tick back-test. Even if you decide to work in M1 timeframe, you are effectively sampling a tick every 1 minute - not every 1 second.

Your code is actually quite a valid way to arbitrarily filter ticks, however. The only issue is that the OnTick method is still being called for every tick, so you may not save too much processing overhead unless your EA's OnTick is CPU/memory intensive.

Just to give you an idea of how things currently work; HST files do not store any tick data - only the OHLC price for that timeframe. When testing, the Strategy Tester generates an FXT file with price movements which is based on HST data and the selected modelling type:

- Every tick - interpolated data based on the number of ticks which occurred in a bar (as recorded in the 'volume' field). We are not sure of the exact algorithm, but this is a generated list of prices and they are purely a simulation of tick activity in a bar.
- Open prices - a single tick of the open price at the start of the bar formation.
- Control points - 4 ticks representing the open, high, low and close of the bar.

If you require greater accuracy/granularity of the ticks, then the only way is to bypass MT4's generation of the FXT file and create one yourself. Therefore, what we are discussing is how to produce an FXT which is more accurate than the standard MT4's modelling (i.e. 1-minute based ticks) but less voluminous than recording every single tick available.

Hope this helps.

bsalus
Posts: 2
Joined: Sun Sep 20, 2015 4:23 pm

Re: Faster backtest with x second interval/timeframe

Post by bsalus »

We are also testing EAs with high number of params that would really benefit from this approach. It would be great to be able to set interval at export as not all EAs require same granularity.

siolibros
Posts: 13
Joined: Fri May 27, 2016 9:04 am

Re: Faster backtest with x second interval/timeframe

Post by siolibros »

hi guys
thanks for your interest

i'll try to reply to your checks

1) yes, it's correct
but i've never talked about higher timeframes like M5
backest using only 1 price every 5 minutes is probably uneuseful for most of EAs
but i demostrated that with at least 1 minute precision, it's quite good, and really similar to tick data
to get almost identical results with tick data, we should all need some seconds timeframes
the advantage of using my method (discarding original fxt files from tickstory) is that we'll all have a great speed improvement, mantaining comparable results with tick data backtest
i always spoken about lower timeframes than M1, that actually are impossible to backtest
that's the reason i'm asking your support

2) same reply as point 1

yes, i know that HST files does not contain any tick data, but only OHLC prices

the problem of your great FXT generated files is the speed of backtest
it's not your fault obviously, it's only due to the large amount of ticks included


my primary target of this thread is about improving mt4 backtest speed, without losing reliability
the seconds timeframes request is just a logic consecutive request
if tickstory will release a new update letting seconds timeframes, we'll have 2 ways to use them:

1) STANDARD WAY
use seconds timeframes with HST and FXT files created with tickstory
this way will only add seconds timeframes option, without any backtest speed increase
we'll just be able to backtest on "every tick" mode on new seconds timeframes
ok, interesting new timeframes to work on, but nothing so revolutionary as i'm proposing
no changes in FXT files required... why discuss about this?
in fact the FXT will remain unchanged (full of tick data), exactly as the standard M1,M5,M15,M30,H1,H4,D1 timeframes
it's the correct way. no reason to change the FXT file. we still need full tick data inside it. changes will be only on new seconds HST files
due to the fact that mt4 does not natively support seconds timeframes, the only way is to name the new HST and FXT files with the same name of minutes timeframes
i suppose that tickstory software will alert with a popup telling to the user that to use S1 timeframe, he will have to still select the M1 timeframe in mt4 backtest
in same way, to use new S5 timeframe, he will have to select the M5 timeframe in mt4 backtest
and so on...

2) REVOLUTIONARY WAY
use seconds timeframes in a new way to greatly increase mt4 backtest speed, using my new suggested method
in this case we'll have to use new detailed seconds HST files to let mt4 create ad-hoc FXT files on the fly, using the "open price only" mt4 backtest method
pay attention: a little modification of mql4 EA is required, telling our EA to work only on each open bar
in this way we'll all benefit from a backtest time reduction of about 30-40 times! with identical results with tick data backtest! (mantaining the new code, obviously)

this solution is already possible with actual M1 timeframe, i already demostraded it with clear numbers
the actual problem is that using only 1 price every minute (instead of 1 price every tick) could not be enough for some EAs, specially for scalper EAs
that's the reason i'm requesting the option to export HST in S1,S5,S15,S30 timeframes, mantaining the same FXT file of standards actual timeframes
in any case, we'll never use the FXT files, but only the news seconds HST files

that is the point! i've never requested any new complicated FXT file... but only some new HST files with internal interval based on seconds...

to be sure about all my tech considerations, today i restarted all my tests on a third party EA
i used the most famous free Expert Advisor on the world, jtatoday Blessing
it's a very complex grid system, with 5 different indicators for entry rules and tons of settings to optimize
the EA is really very good. furthermore, it's the most voted and commented EA on myfxbook EA comparison
it has several years of development and a great users community

unfortunately, due to its complexity, it's very slow to backtest on tick data
it takes about 5 minutes to backtest on 4 years eurusd tick data, on a powerful intel core i7 computer, with 8gb of ram and SSD disk
just think to optimize it on the same period, with thousand of elaboration...
mt4 genetic algorithm often limits total combination to about 10000 backtest (if you are lucky, otherwise could be up to 20000)
10000 x 5 minutes = 50000 minutes = 833 hours = 35 days to optimize with just few parameters
i'm working on blessing from several years... i can assure you that it's correct...

well, TODAY i did a backtest on Blessing, eurusd M1, with FXT tick data precision, spending about 5 minutes
that confirmed my rows above
after that, i recoded Blessing mql4 to work only on open price bar, and re-backtested it on same FXT data, getting almost identical results in just 1 minute
finally, i re-backtested it using open price method (using same HST file from tickstory), with new FXT file generated on the fly
the results was impressive!!! only 5 seconds!!! with almost identical results!!!
the difference is about 1% in max drawdown value, but profit and trades number are identical!!!
5 minutes became 5 seconds!!!
60 times faster!!! it's a revolution in mt4 backtest world!

so my idea is good and really amazing, it works! not only on my EAs!
the little differences in backtest are due to the limit of M1 HST file, not on the FXT file
i'm sure at 100% that backtesting on seconds timeframes using only your HST file, i will get the same results of the original tick data, saving 40X the time!

i hope to have better explained my great tech solution
users will be free to choose which method to use for backtest...
anyone could bet on which one...

i already have prepared all mql4 code to verify the seconds timeframes functionality
i will be happy to test it as betatester to help you work faster, before public release version
i expect that a S30 backtest will produce the exact double of counted bars than a M1 timeframe, and so on

tickstory dev team, feel free to contact me via PM. i will be happy to have a quick skype call and video demonstration directly from my Computer ok?

radu
Posts: 30
Joined: Tue Feb 12, 2013 8:35 am

Re: Faster backtest with x second interval/timeframe

Post by radu »

siolibros: tickstory and me understood your you idea already in your first post. It's just you don't need any new timeframe creation to use your solution.

TSL has all of the ticks coming from Dukascopy; as far as I understand, we discussing your idea. The idea seems to be good (with the comments about floating values I mentioned earlier), but you have to acknowledge that you are eventually missing ticks, movements.

You proposing:

1. Create HST files with TSL (M1, S1, S5, doesn't matter)
2. Give MT4 the possibility to create FXT files on-the-fly
3. Usage of "open price" modelling, rewrite some ea-s.

My proposal:

1. Create HST files with TSL, but only on standard timeframes (as usual)
2. Create FXT files with TSL, with a new way (leave out most of the ticks, in order to create exactly what you are saying, just from the tick data point of view)
3. Use the FXT files as usual, on M1 or any other timeframe (one could use the "Every tick" method, because only the relevant ticks has been exported to the FXT file)

With my solution, one does not need:

* rewrite the EA
* tricking with S1, S5. timeframes.

The result will be exactly the same - as I earlier mentioned, most of the ticks will be left out - like in your solution. This fact was the primary reason of my to write about a good algorithm (it's not necessary, but could be good) which ticks should be included and which should be left out. I'm just saying we could decide this on our own, in order to handle the floatings the most precise way possible.

siolibros
Posts: 13
Joined: Fri May 27, 2016 9:04 am

Re: Faster backtest with x second interval/timeframe

Post by siolibros »

ciao Radu
thanks for explanation

my proposal:
1) does not require any additional logic to be added to tickstory
2) few hours to implement, with no tests required. the software should simply allow a different internal multiplier to get seconds timeframes
3) no changes in fxt file, that's important to leave unchanged to be compared with the generated FXT file from mt4 (comparison should always be easily available)
the original full tick data FXT file will be named automatically EURUSD1_0.fxt (from tickstory)
the FXT file generated onthefly from mt4 (open prices only) will be named automatically EURUSD1_2.fxt (from mt4)
it will be very simple to swap them from the backtest model menu in MT4, simply switching from "every tick" to "open prices only". no way to confuse them
4) just 3 rows of standard native mql4 code to add at the beginning of expert advisor. it's OPTIONAL if you want to get lightning backtest speed
5) if we backtest on S5 timeframe, we'll use exactly a S5 live chart on mt4 (using for example the famous mt4i.com tool i indicated in a previous post)
in that way we'll be sure of exact corresponding parameters between backtest and live trading
6) my solutions will let anyone to test their EA/indicators on new timeframes seconds, probably finding new trading logics and opportunities. just imagine scalpers on seconds timeframes! noone tried it before!
after backtesting on S5 timeframe, we'll be able to trade on a S5 timeframe: the ideal solution
7) finally, my proposal will let: 1) adding 4 new seconds timeframes to backtest and to use in live trading; 2) adding OPTIONAL way to backtest at lightning speed

your proposal:
1) requires new logic to be added to tickstory, trying different solutions to generate a new kind of FXT file. actually 3 proposal... and probably more counting...
2) some weeks to implement, with additional tests because the new logic inside FXT files
3) totally new FXT file that will not include all tick data. in this way we'll have to create a secondary full FXT file to be compared, with file renaming problems
4) no modifications to original mql4 code
5) when going live, we'll receive all ticks from live server. this live stream will be different from FXT stream previously backtested
so we still need to use a seconds timeframe to be sure of corresponding feeds
6) no ways to test any EA or indicator on seconds timeframe, because you are only proposing to change the FXT file format
7) finally, your proposal will let only to get faster backtest speed. no new timeframes added

i kindly ask tickstory dev team to try only spend few hours to generate new HST file S1,S5,S15,S30. i will be happy to test immediately and give you back results
if you are already using CSV2FXT script from great Birt, it's really simple. i've already found the row to modify to let creation of potential seconds HST files

this is the original code from Birt
for (i = 0; i< ExtPeriodCount; i++) {
ExtPeriodSeconds = ExtPeriods * 60;
ExtBars=0;
ExtLastBarTime=0;
}

60 means surely 60 seconds, to create M1 timeframe...
just use 30 to create S30 timeframe and so on...

but i'd prefer to ask professional support to tickstory dev team

thanks for all your support
thanks Radu for all your tech considerations

tickstory
Posts: 4883
Joined: Sun Jan 06, 2013 12:27 am

Re: Faster backtest with x second interval/timeframe

Post by tickstory »

Hi Siolibros,

Thanks both both you and Radu for the input. I'm not sure if you caught our original message. HST data is a minimum granularity of 1-minute. If you decide to export S10, S30, etc, there is no way we know of to use it in the way you describe. Bear in mind that MT4 names its files based on the timeframe - EURUSD_60.hst (1-Minute), EURUSD_240.hst (1-hour), for example. It does not read any file that is named differently than the known time-frames, so creating a EURUSD_30.hst will be ignored. If it is possible to replace data in the M1 with S30 data (for eg), then all charts would be out-of-whack which would cause users other problems. This means this the solution wouldn't be our preferred option for these (and many other) technical reasons. If you have the expertise, I would suggest that you try modify the HST generation script to run with tick data and export to a HST file. I think you'll find that you may run into issues getting MT4 to use the data as you expect (assuming MT4 doesn't give you an outright error for not having M1 data). Appreciate the suggestion though.

The implementation approach we would like to take is to filter the FXT file. This is a proven method and fits in exactly with the current MT4 FXT generation model so therefore wont easily be broken by future MT4 releases. I think it's worthwhile to note that we are all talking about the same high-level goal here - to speed up back-testing. We just want some input on useful algorithms to filter ticks and you can then leave the implementation detail up to us.

Radu - I'm not sure how your Option 4 differs from Option 2 that was mentioned. I don't see how it would dramatically affect results. Basically you are creating S10, S30 etc candles as Siolibros suggested. Potentially you can go down to a S5, S4, S1 and then tick timeframe to progressively get more accuracy. I would rate this as the most consistent solution at this stage.

Regards.

boerseun
Posts: 5
Joined: Fri Dec 14, 2012 11:23 am

Re: Faster backtest with x second interval/timeframe

Post by boerseun »

Yes, I will also be interested in the the per seconds interval functionality. I assume there will be a slight drop in accuracy but in most cases it would hopefully not have a significant effect on the end results.

My problem has always been that I stop backtesting and optimising my EA's cos my PC just can't handle the amount of data it must process. So anything which will help my type of user to do more optimisation runs etc, would be great

Thanks for the idea

Post Reply