How to ACCURATLY BackTest EAs on offline chart like renko, rangebars?

 

There are several vendors charting system like Renko, rangebar, tick chart and so on.

It is easy to attach EA and run EAs on these types of charts.

However, back testing EA on these charts is real problem.

Some of the vendors have their methods on how to back test but these methods do not back test accuratly.

Most of the time these backtesting results give very optimistic and very profitable equity curves but in reality that do not match with real/live account.

According to my observation, the reason behind this is the way these bars are generated from standard M1 chart.

In some cases I found that the tick movements in these Bars are not in the same order as they are in M1 chart and as a result STOPLOSS used in EA run on these chart do not exactly taken-out in the same way it would be on NOrmal Bars (like M1, M15,M30,H1 ...). Therefore, during backtesting of these bar closing of (short or long) of orders results in profit which in reality it would have resulted in Stop Loss.

This is serious issue and due to this reason it is very hard to develop/test EA on such charts.

Does anyone know how to test EAs accuratly on these types of chats?

Any commnets on this will be greatly appreciated.

 
netFX:

According to my observation, the reason behind this is the way these bars are generated from standard M1 chart.

In some cases I found that the tick movements in these Bars are not in the same order as they are in M1 chart and as a result STOPLOSS used in EA run on these chart do not exactly taken-out in the same way it would be on NOrmal Bars (like M1, M15,M30,H1 ...). Therefore, during backtesting of these bar closing of (short or long) of orders results in profit which in reality it would have resulted in Stop Loss.

This is serious issue and due to this reason it is very hard to develop/test EA on such charts.

Does anyone know how to test EAs accuratly on these types of chats?

Any commnets on this will be greatly appreciated.

I have seen something similar when I was trying to run an EA in the Strategy Tester using my own offline data. In the end I ran the standard data in the ST but my EA looked at the offline data to make trade decisions . . . so the basic timing was from the standard data but trade decisions were based on the offline data. It worked OK but there are some tricky considerations to worry about . . . Bar 0 data for one.
 
RaptorUK:
I have seen something similar when I was trying to run an EA in the Strategy Tester using my own offline data. In the end I ran the standard data in the ST but my EA looked at the offline data to make trade decisions . . . so the basic timing was from the standard data but trade decisions were based on the offline data. It worked OK but there are some tricky considerations to worry about . . . Bar 0 data for one.

Hi Raptor,

Oh, even you are trying something like this but find it not that straight forward ...... I am playing with EA RenkoLiveChart (https://www.mql5.com/en/code/9358), to generate Renko in offline chart. However, it is actually based on M1 bars in the past to create the Renko bars, not based on ticks. Is it the concern you see?

I don't exactly get what you mean. On the other hand, I am thinking if the way to solve this could be as follow:

1. Firstly, do tick backtesting with EA RenkoLiveChart and hope it can generate the same renko offline chart as in demo/live trade.

2. Then, do another tick backtesting but this time with my own trading EA.

Do you think this could work?

 
RaptorUK:
I have seen something similar when I was trying to run an EA in the Strategy Tester using my own offline data. In the end I ran the standard data in the ST but my EA looked at the offline data to make trade decisions . . . so the basic timing was from the standard data but trade decisions were based on the offline data. It worked OK but there are some tricky considerations to worry about . . . Bar 0 data for one.

Seems what I suggest won't work. It seems when backtesting with tick and FXT file (yes, thanks for your advice two days ago, I manage to run BIRT's Tick Data Suite now), it just refers to the ticks and won't refer to the offine HST that I've prepared.

Maybe it's good. Maybe I get what you mean now ........ but another challenge ....................

 
lingwuchung:

Hi Raptor,

Oh, even you are trying something like this but find it not that straight forward ...... I am playing with EA RenkoLiveChart (https://www.mql5.com/en/code/9358), to generate Renko in offline chart. However, it is actually based on M1 bars in the past to create the Renko bars, not based on ticks. Is it the concern you see?

Just to be clear, I haven't ever used Renko bars, what I was working with was something completely different. It needed an offline chart though and that was where the similarity came in. My issue was that my M1 data was not synchronised with my offline chart so my ticks generated from my M1 data did not make sense when viewing my offline data in the Strategy Tester.

The issue you are going to have is you need to get the Renko bars into the Strategy Tester . . . they do not have uniform timings . . and you will probably end up with the same timing issues that I had, try it and you will see . . or maybe you won't have an issue.

 
RaptorUK:

Just to be clear, I haven't ever used Renko bars, what I was working with was something completely different. It needed an offline chart though and that was where the similarity came in. My issue was that my M1 data was not synchronised with my offline chart so my ticks generated from my M1 data did not make sense when viewing my offline data in the Strategy Tester.

The issue you are going to have is you need to get the Renko bars into the Strategy Tester . . . they do not have uniform timings . . and you will probably end up with the same timing issues that I had, try it and you will see . . or maybe you won't have an issue.

Are you using BIRT's Tick Data Suite? Is the problem you're facing caused by TDS?

I can successfully generate the renko offline chart (a H4 one) by placing the EA RenkoLiveChart in Strategy Tester. However, TDS (i.e. backtesting with ticks) just doesn't make use of it and recreate its own H4 chart (probably based on the fake H4 renko chart which isn't H4 at all) for backtesting and therefore all my trading decision has become wrong.

My Renko Offline chart in H4 as viewed under "Open Price" model:

The same H4 chart becomes like this in "Every tick" model (with TDS):

 
RaptorUK:

Just to be clear, I haven't ever used Renko bars, what I was working with was something completely different. It needed an offline chart though and that was where the similarity came in. My issue was that my M1 data was not synchronised with my offline chart so my ticks generated from my M1 data did not make sense when viewing my offline data in the Strategy Tester.

The issue you are going to have is you need to get the Renko bars into the Strategy Tester . . . they do not have uniform timings . . and you will probably end up with the same timing issues that I had, try it and you will see . . or maybe you won't have an issue.

"My issue was that my M1 data was not synchronised with my offline chart so my ticks generated from my M1 data did not make sense when viewing my offline data in the Strategy Tester."

So why don't you synchronize your offline chart with your M1 data (where the ticks are derived from)? Like me, my offline chart (renko), my FXT H4 data are all generated from the same source of ticks and I suppose they're syncrhronised, but I am yet to verify that because the Tester just isn't showing exactly the renko bars.

 
lingwuchung:

Are you using BIRT's Tick Data Suite? Is the problem you're facing caused by TDS?

I can successfully generate the renko offline chart (a H4 one) by placing the EA RenkoLiveChart in Strategy Tester. However, TDS (i.e. backtesting with ticks) just doesn't make use of it and recreate its own H4 chart (probably based on the fake H4 renko chart which isn't H4 at all) for backtesting and therefore all my trading decision has become wrong.

Why on earth would you think that TDS would use your offline chart ? The tick data is held within the fxt file, this fxt file is created from the tick data . . . this has nothing to do with your offline renko chart. I don't know much about renko but isn't it timeframe independent ? shouldn't a renko chart derived form an M1 chart be exactly the same as one derived from a H4 chart ?


I wasn't using the TDS when I had my problems with offline charts.

 
lingwuchung:

"My issue was that my M1 data was not synchronised with my offline chart so my ticks generated from my M1 data did not make sense when viewing my offline data in the Strategy Tester."

So why don't you synchronize your offline chart with your M1 data (where the ticks are derived from)? Like me, my offline chart (renko), my FXT H4 data are all generated from the same source of ticks and I suppose they're syncrhronised, but I am yet to verify that because the Tester just isn't showing exactly the renko bars.

My offline charts were derived from the M15 and H1 charts, I couldn't make a M1 chart to match.

Which timeframe data are you overwriting with your renko data to get it into the Strategy Tester ?

 
RaptorUK:

Why on earth would you think that TDS would use your offline chart ? The tick data is held within the fxt file, this fxt file is created from the tick data . . . this has nothing to do with your offline renko chart. I don't know much about renko but isn't it timeframe independent ? shouldn't a renko chart derived form an M1 chart be exactly the same as one derived from a H4 chart ?


I wasn't using the TDS when I had my problems with offline charts.

Thanks Raptor. I just haven't figured out how TDS works internally. What you describe certainly makes sense to me now.

I am using the EA RenkoLiveChart to overwite my H4 data to give me the renko offline hst data. Why ask? It's not use if TDS doesn't make use of offline hst data.

Suddenly think of this. Why on earth (pretending your tone, ha ha :) am I trying to use tick backtesting on renko? To make my life easier, maybe I should give up renko backtesting by tick. If I change my strategy to make decision on [1] but no [0] data, I don't have to worry how the ticks are moving within the [0] bar and could have just use "Open Price" backtest provided by MT4 natively. Let me verify if that will work. Maybe it doesn't make too much difference in real life. Actually when I think back now, why would I refer to [0] data if I'm using renko, for renko is exactly used to filter fluctuation without the current bar which I shouldn't refer to?????!!!!

 
lingwuchung:

1. Thanks Raptor. I just haven't figured out how TDS works internally. What you describe certainly makes sense to me now.

2. I am using the EA RenkoLiveChart to overwite my H4 data to give me the renko offline hst data. Why ask? It's not use if TDS doesn't make use of offline hst data.

3. Suddenly think of this. Why on earth (pretending your tone, ha ha :) am I trying to use tick backtesting on renko? To make my life easier, maybe I should give up renko backtesting by tick. If I change my strategy to make decision on [1] but no [0] data, I don't have to worry how the ticks are moving within the [0] bar and could have just use "Open Price" backtest provided by MT4 natively. Let me verify if that will work. Maybe it doesn't make too much difference in real life. Actually when I think back now, why would I refer to [0] data if I'm using renko, for renko is exactly used to filter fluctuation without the current bar which I shouldn't refer to?????!!!!


1. The TDS has nothing to do with creating your fxt file, that is done using different code, for example I used CSV2FXT to create my fxt files.

2. You will have to try it, but my initial thoughts were that this wouldn't work correctly. When you run your EA in the ST using this H4 data you will see your renko bars but I suspect that if you run the ST in slow speed, maybe 30, you will see that the renko bars are not forming correctly . . . shouldn't you be overwriting your M1 data with your renko hst file ? and then using M1 in the ST ?

3. It's good to try unconventional things sometimes, it's often the way you will learn the most.

Reason: