9.3 Multi-timeframe (MTF) indicators
A brief note on “multi-timeframe” (MTF) indicators.
As much as 99% of all the MTF indicators ever written are, in essence, junk. Looking back over a historic trading chart they appear to be giving impossibly good signals… because they are doing something impossible. They let themselves see into the future.
Take, for example, an indicator which compares short-term and long-term data, such as M5 and H4 candles. A typical implementation is that the indicator runs on M5 data and then additionally requests H4 bars from the environment (for example, using iBarShift etc in MT4).
Unless the indicator code is extremely careful and scrupulous, it is then going to see into the future. For example, at 10:35 yesterday on the M5 chart the indicator is going to be looking at an H4 candle with data ending at 11:59. The indicator can see into the future, knowing at 10:35 what didn’t happen until 11:59.
The only safe way to create an MTF indicator is to run on the lowest timeframe and build your own candles for the higher timeframes, making sure that you do so on a cumulative, as-at basis, and don’t let yourself look into the future. The Sway.CandleStore object can help with candle aggregation, but you still need to be very careful about not building a time machine for yourself.
An indicator with UDIX access can request additional bar data from the environment, using Framework.RequestCandles(). Doing this, however, for a higher timeframe will almost certainly lead to a junk indicator.
The example UDI code contains an illustration of doing a proper MTF calculation which does not look into the future.
Last updated