All indicators

MACDh with divergences & impulse system

Jul 31, 2023

Static chart image
OscillatorsDivergencesMoving Averages

The MACDh with divergences & impulse system indicator provides a comprehensive toolkit for analyzing momentum and identifying potential trend reversals through classical MACD histogram divergences and a color-coded Impulse System. It allows users to filter divergence patterns based on specific geometric criteria like peak height and width to enhance signal reliability.

Usage

The indicator can be used to identify bullish and bearish trend exhaustion points across any asset or timeframe.

  • Divergence Trading: A regular bullish divergence occurs when prices reach a lower low while the MACD histogram forms a higher low, suggesting downside momentum is fading. Conversely, a bearish divergence occurs when prices hit a higher high but the histogram reaches a lower peak.
  • Impulse System: This feature colors the histogram bars based on the relationship between a 13-period EMA and MACD momentum.
    • Green Bars: Both price trend (EMA) and momentum (MACD-H) are rising, indicating strong bullish control.
    • Red Bars: Both price trend and momentum are falling, indicating strong bearish control.
    • Blue Bars: Mixed signals where trend and momentum conflict; these serve as "permitted" zones for either buying or selling.
  • Filtering: Users can adjust the "width" (horizontal distance) and "height" (vertical deviation) requirements to ensure only significant divergence structures are plotted on the chart.

Details

The script implements a classic MACD (typically 12, 26, 9) but extends its functionality by tracking historical peaks and troughs to identify divergences. The Impulse System component acts as a censorship mechanism: it discourages selling during green impulses and discourages buying during red impulses. The divergence logic includes both temporary signals and confirmed signals that trigger once the histogram crosses the zero line, validating the structural shift in momentum.

Settings

MACD

  • Fast Length: Sets the period for the fast exponential moving average.
  • Slow Length: Sets the period for the slow exponential moving average.
  • Signal Smoothing: Determines the smoothing period for the MACD signal line.
  • Plot Macd & Signal Lines?: Toggles the visibility of the MACD and Signal lines.
  • Show Impulse System over MACD histogram?: When enabled, colors the histogram bars according to the Impulse System logic.

MACD Histogram Divergences Criteria

  • Vertical deviation on Price peaks: Sets the minimum vertical difference required between price peaks for a divergence to be valid.
  • Vertical deviation on MACD Histogram peaks: Filters divergences based on the ratio of the first histogram peak to the second.
  • Divergence min/max width: Defines the range of bars allowed between the two peaks of a divergence pattern.
  • Plot regular Bullish/Bearish divergences?: Toggles the drawing of divergence lines for specific directions.
  • Delete Previous Cancelled Divergences?: Cleans up the chart by removing lines from patterns that did not finalize.
  • Plot Temporary/Confirmed Signals?: Toggles the display of triangular labels for unconfirmed and confirmed divergence signals.

FAQ

How do I use the Impulse System colors?

Green bars mean bulls are in control (don't short), red bars mean bears are in control (don't long), and blue bars indicate a neutral state where the trend and momentum are not aligned.

Can I adjust the divergence sensitivity?

Yes, you can modify the "Vertical deviation" and "Divergence width" settings in the inputs menu to filter out small or overly extended patterns.

How do I access MACDh with divergences & impulse system?

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.