All indicators

RSI + Divergences

Mar 10, 2020

Static chart image
SignalsOscillatorsDivergencesPivot Based (Retrospective)

The RSI + Divergences indicator identifies regular bullish and bearish divergences between price action and the Relative Strength Index (RSI) to highlight potential trend reversals. By comparing price pivot points with corresponding RSI values, the tool automatically plots divergence lines and customizable labels to assist traders in spotting momentum shifts.

Usage

The tool can be used to identify exhaustion in the current trend and potential reversal zones.

  • Bullish Divergence: Occurs when the price makes a Lower Low (LL) but the RSI makes a Higher Low (HL). This suggests downward momentum is fading.
  • Bearish Divergence: Occurs when the price makes a Higher High (HH) but the RSI makes a Lower High (LH). This suggests upward momentum is slowing down.

Traders often use these signals in conjunction with market structure and key support/resistance levels to confirm entries. The "Just Show Arrows" mode can be enabled to clean up the chart by removing connecting lines while keeping the signal markers.

Details

The script utilizes pivot point logic to identify significant highs and lows in both price and the RSI. It compares the current pivot to up to eight previous pivots to find valid regular divergences.

  • Regular Bullish Divergence: Detected when Price LL + RSI HL.
  • Regular Bearish Divergence: Detected when Price HH + RSI LH. The implementation includes a "Margin" setting which acts as a filter for price structure, ensuring that intermediate price action does not excessively violate the divergence trend before a signal is confirmed.

Settings

RSI Settings

  • Source: The price data used for RSI calculation (default is Close).
  • RSI Length: The lookback period for the standard RSI.
  • Fast RSI Length: The period for a more sensitive RSI calculation.
  • EMA Length: The length of the Exponential Moving Average applied to the RSI.
  • Overbought/Oversold: Level thresholds for the RSI oscillator.

Divergences

  • Show Regular Divergences: Toggles the visibility of all divergence signals.
  • Just Show Arrows (No Lines): Removes the trendlines connecting the price/RSI pivots, leaving only the labels.
  • Line Type: Changes the visual style of divergence lines (Solid, Dashed, Dotted).
  • Linewidth: Adjusts the thickness of the plotted lines.
  • Bullish/Bearish Labels: Selects the icon style for the signals (e.g., Arrow, Triangle, Diamond).
  • Label Size: Adjusts the size of the signal icons.
  • Margin: A multiplier used to filter out noise and validate the structural integrity of the divergence.

Pivot Settings

  • LeftBars: The number of bars required to the left of a pivot to confirm it.
  • RightBars: The number of bars required to the right of a pivot to confirm it (note: higher values increase signal lag but improve accuracy).

FAQ

How do I access RSI + Divergences?

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

Does this indicator show hidden divergences?

No, this specific tool is designed to identify only regular divergences, which are typically used to spot trend reversals rather than trend continuations.

Why does the signal appear a few bars late?

Signals are based on pivot points, which require a certain number of confirmation bars (defined by the "RightBars" setting) to ensure a high or low is actually formed. This is a standard requirement for non-repainting divergence detection.

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.