Return signals of the internal MACD divergences indicator of the platform.
Syntax:
1 |
DivergenceMACD[Fastperiod, SlowPeriod, SignalPeriod, Bars](price) |
Where:
Shortperiod = Moving Average Convergence Divergence (MACD), fast MA period of calculation, default is 12 periods
SlowPeriod = Moving Average Convergence Divergence (MACD), slow MA period of calculation, default is 26 periods
SignalPeriod = MACD signal line MA period of calculation, default is 9 periods
Bars = Bars quantity to detect a potential divergences, default is 20
Calculation: This indicator detects bullish and bearish divergences between price and the MACD. A bullish divergence occurs when the stock price makes new lows while the indicator starts to climb upward. A bearish divergence occurs when the stock price makes new highs while the indicator starts to go lower.
Interpretation: The divergences indicate a slowdown of the current trend and a probability of a reversal. If a bullish divergence is detected this indicator returns +1 (green histogram). If a bearish divergence is detected, the indicator returns -1 (red histogram). If no divergence is detected, the indicator returns 0.
Tip: If looking at a price chart, a MACD chart and a MACD divergence chart, make sure that you have set the parameters of the MACD and MACD divergence to the same levels (ex: 12, 26, 9).
Example:
1 2 3 |
i = DivergenceMACD[12,26,9,20](close) return i style(histogram) |