Trading on renko charts built from real ticks

15 June 2018, 11:05
Stanislav Korotky
0
1 758

In my previous blog post I described several approaches for adapting EAs to trade on renko charts (based on custom symbols introduced in MetaTrader 5). All of them use custom symbols created by RenkoCharts product (free demo is available). The previous research utilises the key feature of the product to generate renko from different timeframes of your work symbol. It was shown that M1, obviously, provides the best accuracy among all timeframes. But what if we go down to the ticks level?

Indeed, with the support of real ticks in MetaTrader 5, it's possible to render a renko chart straight from the ticks. I implemented a special version of RenkoCharts which does not use bar history, but downloads and processes real ticks instead.

To remind you what we have had in the previous post, I'm duplicating the tester report of two MAs crossing EA running on M1-originated renko:

Tester result for 2 MAs crossing strategy on custom renko built from M1 with trading on underlying symbol EURUSD

Tester result for 2 MAs crossing strategy on custom renko built from M1 with trading on underlying symbol EURUSD

Now let's take a look at result of the same EA running on renko built from real ticks:

Tester result for 2 MAs crossing strategy on custom renko built from real ticks of EURUSD

Tester result for 2 MAs crossing strategy on custom renko built from real ticks of EURUSD

Here EURUSD_M1_r100 and EURUSD_T_r100 are custom symbols with 100 points renko built from M1 bars and ticks respectively.

As you can see, there is some difference, but it's very subtle, I'd say. Supposedly, the result based on ticks is more realistic, and this is why it demonstrates slightly lower profitability. But the effect is barely noticed.

So, is it worth using ticks instead of bars to build renko?

First, remember that the question applies to the testing on history only. Live renko charts are always forming on ticks, no matter which timeframe is used as a host for RenkoCharts.

Second, real ticks are massive data. Be prepared to reserve a couple of Gigs per symbol on your hard drive. Also, building renko from ticks may require some time - it's not a big deal, of course, but definitely not a blink of the eye. For example, on an average computer you may expect that 1 year of a renko chart is built for 1 minute.

Third, there can be problems with ticks history. Since every tick seem very small thing and they are very many (for example, several hundred thousand per single day), the chances are that broker will not spot some errors there. But errors in the ticks may affect renko in a negative way. According to my tests, errors in ticks are much more frequent than errors in bars. Here is 2 most frequent problems with ticks:

  • on stock exchange tickers I see some special undocumented ticks (while on Forex everything seem ok); these ticks contain zero prices despite the fact that TICK_FLAG_BID and TICK_FLAG_ASK flags are switched on in corresponding tick structure, implying that prices are meaningful; I'm not sure what such prices mean, but this is apparently not an actual ticker price, but a special control statement; as far as I can see, such ticks appear at the end and at the beginning of each trade session, and they're accompanied with another "tricky" ticks - part of them contains so called "high ask" and "low bid" values; the tricky part here is that these prices do not participate in construction of the bars; in other words, at the moments when the control ticks arrive, most of bars have equal OHLC prices, whereas "high ask" and "low bid" are much higher and much lower respectively; hence the unwanted ticks (and who knows exactly - which ones?) must be somehow eliminated from the process of building renko, otherwise the renko becomes incorrect; yet the principles of the special ticks flow are undocumented; to workaround this I was compelled to invent some strange manipulations, but they do no seem appropriate for a rock solid product;
  • there are cases, even on Forex tickers, when historical ticks contain bid (and ask) prices outside their bar ranges: since ticks form bars, they should correspond to each other; again, using such inconsistent ticks for building renko leads to incorrect renko, so it's necessary to filter out such ticks;

Fourth, even based on ticks, renko charts in MetaTrader 5 can handle boxes with 1 minute precision maximum, because M1 is the least supported timeframe.

Taking all this into account, it's not so obvious that using ticks makes sense. Probably, current approach with processing of bars is more reliable and efficient, and still provides acceptable accuracy.

The special version of RenkoCharts which uses ticks is still under development. I don't know if this feature should be included into the existing product, or published as a separate product, or thrown away completely. Your feedback is important to me to make a decision.

Finally, one small note on custom symbols in MetaTrader 5: it seems that the tester does not always pick up newly generated custom quotes. As a result, the tester can not start a test, throwing an error about incorrect dates. Restart of the terminal helps. Also I have noticed that deleting ticks and rates via MQL's CustomTicksDelete and CustomRatesDelete require quite some time (a second or two) to take effect, and this is performed asynchronously in background. So if your code relies on the fact that ticks or bars must be deleted, it should wait in a loop until the changes are applied. Otherwise, you can get errors, for example, ERR_CUSTOM_TICKS_WRONG_ORDER, and your code can not actually proceed in a designed way. But even this does not work every time - once in a while it fails (the base of ticks is reportedly empty, but a single new tick can not be added due to the error), and only method to resolve this is to close the custom chart, remove the custom instrument from Market Watch, delete ticks manually from UI, and only then the code can work.

If I get more findings i'll keep you posted.

UPDATE

The renko generator based on the real ticks history is now available for everyone. You may find details in the new blog post Volume delta analysis powered by custom renko symbols. MT5 platform has been improved since the date of original publication, and more ideas related to ticks utilization came up and have been implemented, so the approach looks more powerful and useful.


To further improve the backtesting accuracy on renko read the next chapter