All indicators

RSI Divergence Scanner

Jun 29, 2022

Static chart image
SignalsOscillatorsDivergencesVolatility

The RSI Divergence Scanner indicator provides a comprehensive toolkit for identifying momentum shifts through the detection of regular divergences between price action and the Relative Strength Index (RSI). By automatically scanning for discrepancies where price makes new extremes while the RSI fails to follow suit, the tool helps traders pinpoint potential trend exhaustion or reversal points.

Usage

The Usage section describes how the script can be used to identify market structure and momentum changes:

  • Divergence Detection: The indicator automatically plots trend lines on the RSI pane when it detects a divergence. A negative (bearish) divergence occurs when price makes a higher high but the RSI makes a lower high. A positive (bullish) divergence occurs when price makes a lower low but the RSI makes a higher low.
  • Trend Identification: Labels such as HH (Higher High), LH (Lower High), LL (Lower Low), and HL (Higher Low) are plotted on the RSI to provide immediate context on momentum structure.
  • Overbought/Oversold Signals: Visual circles highlight when the RSI crosses into extreme territories (above 70 or below 30), which can be used to confirm divergence setups.
  • Wedge Analysis: The tool includes customizable trend lines that can be extended to visualize potential "wedge" formations within the RSI oscillator.

Details

The RSI Divergence Scanner utilizes pivot points (fractals) to identify significant highs and lows in both price and the RSI. It calculates divergences by comparing the relative values of these pivots over a user-defined lookback period.

Additionally, the script features an optional Standard Deviation background based on linear regression. This provides a volatility-adjusted context to the RSI; when the RSI moves outside these bands and forms a pivot, the background changes color to signal high-probability exhaustion zones.

Settings

Main Inputs

  • Show Divergences: Toggles the visibility of detected divergence lines and labels.
  • Show Points: Displays circles at RSI overbought and oversold levels.
  • Show Dates: Displays the date and time of the detected divergence for easier historical review.
  • Show Trend Lines: Toggles the HH/LL/HL/LH labels and horizontal structure lines.
  • Show StdDev Background: Enables the linear regression-based background coloring.

Alert Settings

  • Detect Longs: Enables detection and alert triggers for bullish divergences.
  • Detect Shorts: Enables detection and alert triggers for bearish divergences.

RSI & Trend Parameters

  • RSI Length: Adjusts the lookback period for the RSI calculation (default 14).
  • Zigzag Length: Defines the pivot window used for identifying market structure labels.
  • Leftbars/Rightbars Length: Controls the sensitivity of the pivot detection used for the divergence lines.

FAQ

How do I access RSI Divergence Scanner?

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

What do the HH and LL labels mean?

These represent Higher Highs and Lower Lows based on the RSI's movement. They help traders identify whether momentum is currently trending or ranging.

Can I change the sensitivity of the divergence detection?

Yes, by adjusting the "Leftbars Length" and "Zigzag Length" in the settings, you can filter out smaller fluctuations or capture more frequent, shorter-term divergences.

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.