All indicators

MACD Divergence Tops + Bottoms

Nov 11, 2019

Static chart image
SignalsOscillatorsDivergencesMoving Averages

The MACD Divergence Tops + Bottoms indicator identifies potential trend reversal points by detecting classic and alternative divergences between price action and the MACD histogram. This tool helps traders pinpoint local peaks and troughs where momentum may be shifting, providing actionable signals for potential trend exhaustion.

Usage

The indicator can be used to spot two primary types of divergences, which are plotted as shapes on the MACD pane:

  • Classic Divergence:
    • Bearish (Top): Higher price high accompanied by a lower MACD high. This suggests weakening bullish momentum.
    • Bullish (Bottom): Lower price low accompanied by a higher MACD low. This suggests weakening bearish momentum.
  • Alternative Divergence:
    • Bearish (Top): Lower price high accompanied by a higher MACD high.
    • Bullish (Bottom): Higher price low accompanied by a lower MACD low.

Traders typically look for these signals to identify macro trend shifts or local exhaustion. It is recommended to use these signals in conjunction with other technical analysis tools and trend filters to confirm trade entries.

Details

The script calculates the standard MACD line, signal line, and histogram based on user-defined moving average lengths. It specifically monitors the peaks and troughs of the MACD histogram relative to zero-line crosses.

A divergence is confirmed when the histogram crosses back toward the zero line (a "crossunder" for tops or "crossover" for bottoms) after a discrepancy between price peaks/troughs and histogram peaks/troughs has been established. This ensures the signal is based on a completed swing in momentum rather than a real-time fluctuation.

Settings

  • Fast Length: The period for the shorter-term EMA used in MACD calculation (default is 12).
  • Slow Length: The period for the longer-term EMA used in MACD calculation (default is 26).
  • Signal Smoothing: The EMA period used to smooth the MACD line into the Signal line.
  • Divergence Types: Choose between "Classic", "Alternative", or "Both" to determine which signals are displayed on the chart.
  • Plot Potential MACD Troughs: Toggles the visibility of bullish divergence signals.
  • Plot Potential MACD Peaks: Toggles the visibility of bearish divergence signals.

FAQ

How do I interpret the colored shapes on the indicator?

Red circles at the top represent bearish (Top) divergences, while green circles at the bottom represent bullish (Bottom) divergences. Orange circles represent Alternative Top divergences.

Should I trade these signals in isolation?

No, it is best to use MACD Divergence in combination with other indicators, such as support/resistance levels or volume, to improve signal reliability.

How can I access this indicator?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.