Dazi MTF smoothed MA Channel
Trend detection by using a channel of two moving averages from higher timeframes (MTF) but smoothed display.
This indicator is designed to run on lower timeframes (the timeframe of the chart the indicator is attached to), calculating values from a higher timeframe (the working timeframe) but smoothing the result on the attached timeframe (Semi-MTF).
It has three advantages:
- faster reaction to price movements as in real MTF mode
- visualize also in backtesting
- any timeframe possible (e.g., H12 or D2)
The overall purpose of the indicator is to detect the trending market. It forms a channel out of two moving averages (on high and low) of simulated bars from the selected working (MTF) timeframe while displaying them on the attached timeframe (=Semi-MTF). Thus the graph is smoothed.
To avoid the detection of small spikes, the range of the channel can be enlarged by a dynamical value (calculated on basis of ATR (Average True Range), but weighted to give the recent bars more power).
Another possibility to filter such spikes is to specify a certain value for confirmation bars: only when the specified amount of bars is closing outside the channel, a trend is detected.
- Timeframe where the indicator shall work (MTF)
The timeframe is selected from the predefined timeframes. It should not be less than the timeframe of the chart the indicator is running at, but is forced to be the chart timeframe in case it is.
- Timeframe Factor
The value the selected timeframe is multiplied by. It will be forced to a minimum of 1.
- maPeriod (standard as for a moving average)
- maShift (standard as for a moving average)
- maMethod (standard as for a moving average)
- dynamic Factor
The parameter defines the strength of the enlarging of the channel. The value may vary from 0 to 1. Lower values are forced to 0, higher values are forced to 1.
A value of 0.5 means that the semi-dynamic value is added to the channel.
- confirmation Bars
The amount of additional bars sequentially closing outside the channel to detect a trend.
0 means the current bar only. 1 means one additional bar (=trend is detected after 2 bars closing outside the channel), etc.
- count inside Bars
The parameter is similar to confirmation bars, but has the opposite nature. It filters spikes going back inside the channel. Only when the specified amount of bars is sequentially closing inside the channel, a previously detected signal for a trend is deleted.
- break Out Arrow Code (value from Wingdings Font) for visualisation of a trend.
Displaying at the higher MA (uptrend) or the lower MA (downtrend) for all bars considered to be a trend.
The default value is 116 (rhombus). 0 means no visualization.
There are 4 return values (buffers).
Buffers 2 and 3 give the high and low values of the MA channel.
Buffer 1 indicates the strength of the bar. It ranges from -2 to +2. Values between -1 and +1 indicate a price within the channel, 0 means the price is in the middle, and values above +1 or below -1 indicate the price is outside the channel. The most important is buffer 0 as this gives the information of trend or range. Taking into account the parameters Confirmation of Bars and Count Inside Bars, it returns the MA value (high or low) when trending, or 0 when ranging inside the channel.
The indicator shall be called with iCustom (NULL, 0, "di_MTF-G-MA-Kan", ..., buffer, shift).
The buffers are as described above. As this is a semi-MTF, the shift corresponds to the bar of the chart timeframe.
Example: chart timeframe is M1, the indicator will work at M15. Then shift 0 returns the current value of the working timeframe (M1), shift 1 returns the previous value of M1 (value at the last closed bar in M1), shift 2 – the value at the second closed bar in M1, etc.
Visualize in Backtest
The indicator works fine in visual charts of the strategy tester. Thus, it is possible to visualize the values of the indicator and to verify the strategy of Expert Advisors while the backtest is ongoing.
The parameter timeframe can only be selected from the predefined timeframes. But it is multiplied by the factor, thus it is possible to work on any timeframe.
Example: chart timeframe is M1, the indicator will work on M10. Then, "timeframe=M1, factor=10" or "timeframe=M5, factor=2" will work.
This may be interesting especially for higher timesframes like H12, D2 or D3.