Dazi MTF MACD
MACD (Moving Average Convergence-Divergence) Indicator with the capability to work on 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 with. Will be forced to a minimum of "1".
- Fast EMA Period (standard)
- Slow EMA Period (standard)
- Signal SMA Period (standard)
The indicator shall be called with iCustom (NULL,0,"di_MTF-MACD",....,buffer,shift).
Buffer corresponds to the provided and required buffer. This indicator provides two buffers: the MACD Histogram (buffer=0) and the signal line (buffer=1).
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 (MACD or signal) 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.
The parameter timeframe 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 with the parameters fastEMA=12, slowEMA=26, signalSMA=9 on timeframe H2 and the expert advisor needs the signal value of the last closed bar of H2, then the function call may be: v=iCustom(NULL, 0, "di_MTF-MACD", PERIOD_H1, 2, 12, 26 ,9, 1, 1)