• Overview
  • Reviews
  • Comments

Dazi MTF MovingAverage

Moving Average Indicator with the capability to work in higher timeframes (MTF).

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

It has 3 advantages:

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


The parameters are same as the standard indicator but with two additional parameters:

  • Timeframe where the indicator shall work (MTF). (additional)
    To be selected from the predefined timeframes. Should not be less than the timeframe of the chart the indicator is running, but is forced to be the chart timeframe in case it is.
  • Timeframe Factor (additional)
    Value by which the selected timeframe is multiplied. Will be forced to a minimum of "1".
  • maPeriod (standard)
  • maShift (standard)
  • maMethod (standard)
  • appliedPrice (standard)


The indicator shall be called with iCustom (NULL, 0, "di_MTF-MovingAverage", ...., buffer, shift).

Buffer corresponds to the provided and required buffer. This indicator provides only one buffer (the moving average), so the buffer shall be "0".

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

Example: active chart is on timeframe M1 while the indicator is working on timeframe 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 corresponds to the value at the 2nd 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 the expert advisor while the backtest is ongoing.

Any timeframe

The timeframe parameter can only be selected from the predefined timeframes. But it is multiplied by the factor, which makes it possible to work on any timeframe.

When the chart timeframe is M1, while the indicator shall work on M10, then the parameters "timeframe=M1, factor=10" or "timeframe=M5, factor=2" will work.

This may be interesting especially for higher timesframes like H12, D2 or D3.

Example for use with iCustom

Assuming the chart timeframe is M5 and the indicator shall calculate the simple moving average with no shift on closed price for a period of 10 bars on timeframe H2 and the expert advisor needs the MA value of the last closed bar of H2, then the function call may be: ma=iCustom(NULL, 0, "di_MTF-MovingAverage", PERIOD_H1, 2, 10, 0, MODE_SMA, PRICE_CLOSE, 0, 1)

No reviews