• Overview
  • Reviews
  • Comments

Dazi MTF MA Channel

Trend detection by using a channel of two moving averages from higher timeframes (MTF).

This indicator is designed to run on lower timeframes (the timeframe of the chart the indicator is attached to) while calculating values from a higher timeframe (the working timeframe).

It has three advantages:

  • buffer shift corresponds to the working (MTF) timeframe (when using in combination with an Expert Advisor)
  • visualize also in backtesting
  • any timeframe possible (e.g., H12 or D2)

Brief Description

The overall purpose of the indicator is to detect the trending market. It forms a channel out of the two moving averages (on high and low) from the bars on the selected working (MTF) timeframe.

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
    The timeframe where the indicator will work (MTF) 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
    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, so in total after two bars closing outside the channel, a trend is detected, 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 visualization 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.  

Return Values

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.

Buffer Shift

The indicator will be called with iCustom (NULL, 0, "di_MTF-MA-Kan" ,...., buffer, shift).

The buffers are as described above.

Shift corresponds to the bar - but of the working timeframe.

Example: chart timeframe is M1, the indicator will work at M15. Then shift 0 returns the current value of the working timeframe (M15), shift 1 returns the previous value of M15 (value at the last closed bar in M15), shift 2 - the value at the second closed bar in M15, 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.

Any Timeframe

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.

No reviews