Download MetaTrader 5

Intra Minute tick data in the history charts

To add comments, please log in or register
Does your signal already have a lot of of subscribers? It's time to think about the paid subscription!
Pipperoni
233
Pipperoni 2015.07.10 11:32 
I download history data from a broker. Can be the "universal" MetaQuotes Software Corp history data in the MT4 > Tools > History Center or data from a broker specific like for example FXCM. The data in the 1 min history are 1 line per minute. But when I put the Back Tester in visual mode, I see intra minute tick activity (see video). The chart on the video is from 2013! and recorded last week.
https://www.youtube.com/watch?v=k-IOl3_hoLE
Where is this tick data coming from ???
ydrol
593
ydrol 2015.07.10 11:57  

Hi , MT4 generates tick data from larger timeframes (starting with M1 first) . see lots of information here .

 https://www.mql5.com/en/articles/1490 

https://www.mql5.com/en/articles/1511 

https://www.mql5.com/en/articles/mt4/strategy_tester 

JD4
1101
JD4 2015.07.10 17:48  

MT4 (and I am guessing MT5 as well) "fakes" the tick data based on the minute values, as ydrol stated slightly differently above.  Basically, they are actually an "educated guess" based on within which minute they would be expected to appear.


Edit:

(adding this to further explain the idea of how I think the fake ticks are made)

Because the tick data I am talking about is a specific time value of less than 1 minute, they are basically (depending on your source) one price value (no OHLC like the other timeframes) and one volume value for that specific instant they represent.  In real operation, those ticks that appear within minute X then are calculated together to ultimately become the OHLC and full volume for minute X.  The lowest time frame value that the tester uses is the one minute time frame, not the ticks, so to recreate the ticks, they have to use some method to do so.  So what I think they do is extrapolate the tick data given that the minute data is known.  For price, they basically "forge" false tick data based on what the minute information actually is.  Obviously, within that minute there is a "tick" value that corresponds to the all 4 major points of a bar, so they have those guaranteed to be within it, one tick each.  And based on the volume, they spread it out through some specific method to make it so the entire volume is distributed among those fake ticks, usually well more than just the 4 "known" ones.  But if they were all combined, would accurately reflect the minute bar they are derived from.  The same is basically true to calculate the higher time frames, except the opposite direction.  The minute bar values are known, and 5 are added for the 5 min, 10 for the 10 min, etc., as Pipperoni shows below.

Pipperoni
233
Pipperoni 2015.07.10 18:29  

In this article:  Tester in the Terminal MetaTrader 4 that you can read here: https://www.mql5.com/en/articles/1490 (thanks ydrol)

I find this:
Important: before starting the testing make sure that all necessary price data of other timeframes is pumped, and that this data is correct. Standard History Center provides the correctness of all timeframes, because it automatically recalculates from the minute data all other periods. 




Considered that we go from a high definition 1 min to lower definition 5 min ...and that the 5 min is "Calculated from the minute data (to all other periods)" how can than the tick data be "recreated" ?

We see also that in the higher TF we have only 1 entry per bar and they contain thus no other info than open high low close.
Unless somebody can enlighten us ... I am afraid that JD4 is correct and that the BT can not now the ticks. In this way back testing a Trailing SL is a USELESS.

Pipperoni
233
Pipperoni 2015.07.12 09:45  

If the 1 min bar can as well be A or B ... than the Back test becomes very imprecise. Because an execution like I see on FXCM takes about 1 to several seconds. And don't believe the promotional blabla, because I have run a high frequency EA from a VPS with a 1ms latency connection to the broker ... and I see how much delay real time execution has .... So if we don't know if a minute bar is A or B ... than we are testing in the dark ! The broker will NOT execute your order when the spike is to narrow, because there is not enough time or/and because your order is in a queue and the liquidity at the spike is insufficient . All EA's need precise data to be able to back test them.



ydrol
593
ydrol 2015.07.12 13:24  

-. The tick data generated by MT4 is 'fake' data.  This is mentioned in the article..

 To generate price movements between control points, interpolation based on the predefined templates is used

It's a fancy way of saying 'guess'.

 

-. You can get real tick data from external sources ( Search Dukascopy, TickStory, Birts ) and 'force' the real ticks into MT4. I say 'force' rather than 'import' because MT4 has no support for this. The external programs have to push the real 'tick' files  into MT4 and make them read only so MT4 will not overwrite them with 'fake' ticks, when you click '[Start]'

 

-There is still an issue with variable spreads during backtesting with MT4. The spread is fixed at present in MT4. Some external programs have ways to deal with this. Not sure how. I suspect Birts TDS has some MQL wrappers around the broker inputs (Ask,Bid ,Series ) and outputs ( OrderSend, OrderModify) that must be used? (just a guess)

 

-.Also you must pay attention to timezones of imported data vs that of the broker. Import tools can take care of that for you.

 

The cynic in me thinks that, as MQ customers are the brokers and not the users, there is no urgency to support full accurate backtesting out of the box.

JD4
1101
JD4 2015.07.12 17:24  
ydrol:

 

The cynic in me thinks that, as MQ customers are the brokers and not the users, there is no urgency to support full accurate backtesting out of the box.

I would agree with this, as I think it is highly unlikely that brokers have any need to backtest.
Pipperoni
233
Pipperoni 2015.07.18 15:34  
I found a possible solution for this lack of accuracy of MT4. If you use a Trailing Stop in your EA ... the result of your Back tests will be VERY different from the real trades. Also if you use a fixed spread in your BT while (nearly) all brokers have a variable spread ... well now you can forget all EAs with a small TP target, that need a fast broker execution. There are people out there that have made programs to improve on the rough BT that is included in MT4. But I am not allowed to give here links because commercial, so Google for tick data backtesting and you will find. They will very much improve the results of a BT ... BUT...There might be an other issue to consider. Even when using ticks to BT, we should have a criteria in the Back Tester to tell the tester how long a price has existed, in order for the broker to be able to, reasonably spoken, execute your order. Even if the price was for 0.1sec at a certain level ... the broker will for sure ignore that tick (unless he chases your stop ...hahahah). So Back Testing and understanding the realism of the results ... is anyway complex.
whroeder1
14514
whroeder1 2015.07.18 16:19  
Pipperoni: Where is this tick data coming from ???
Tester generated 'Strategy Tester: Modes of Modeling during Testing - MQL4 Articles
Pipperoni
233
Pipperoni 2015.07.19 08:29  
Hi WHRoeder. Tick data per currency pair are available from many sources, however they should come from your broker. The one where you want to run your EA on, because brokers have there specific spikiness or hairiness of the candles. Also the day to the next day can differ a lot, etc. Oanda and FXCM have tick data available for there clients for example. If needed I can help with this. You might encounter also compatibility troubles with the format of delivery. In that case find a coder who can write a script to correct the data. Or I can help.
Pipperoni
233
Pipperoni 2015.07.22 10:10  

Here is a detailed explanation on the MQL5 website about "Algorithm of ticks' generation" in the back tester.


12
To add comments, please log in or register