All indicators

RSI Divergence

May 20, 2021

Static chart image
SignalsOscillatorsDivergences

The RSI Divergence indicator aims to identify potential trend reversals and trend continuations by detecting regular and hidden divergences between price action and the Relative Strength Index (RSI).

Usage

The tool can be used to identify entry and exit points based on momentum shifts. Users can look for the following signals:

  • Regular Bullish Divergence: Occurs when price makes a lower low but the RSI makes a higher low, suggesting a potential upward reversal.
  • Regular Bearish Divergence: Occurs when price makes a higher high but the RSI makes a lower high, suggesting a potential downward reversal.
  • Hidden Bullish Divergence: Occurs when price makes a higher low but the RSI makes a lower low, suggesting trend continuation to the upside.
  • Hidden Bearish Divergence: Occurs when price makes a lower high but the RSI makes a higher high, suggesting trend continuation to the downside.

Additionally, the indicator utilizes color-coded RSI levels. The RSI line turns green when in oversold territory (below 30) and red when in overbought territory (above 70). The background is also shaded to help traders visualize the current momentum zone relative to the mid-level (50).

Details

The script identifies divergences by comparing price pivots to RSI pivots within a user-defined lookback window. Regular divergences are highlighted with bright labels to signify their typical strength in predicting reversals, while hidden divergences use muted colors to signify trend continuation. The implementation uses a pivot-based detection system, requiring a specific number of bars to the right of a peak or trough to confirm the pivot point.

Settings

RSI Settings

  • RSI Period: Determines the number of bars used to calculate the RSI.
  • RSI Source: Selects the price data used for the RSI calculation (e.g., Close, Open, HL2).
  • Overbought Level: Sets the threshold for overbought conditions (default is 70).
  • Oversold Level: Sets the threshold for oversold conditions (default is 30).

Divergence Settings

  • Pivot Lookback Right: The number of bars to the right of a pivot to confirm its high or low.
  • Pivot Lookback Left: The number of bars to the left of a pivot used for detection.
  • Max of Lookback Range: The maximum distance allowed between two pivots to qualify as a divergence.
  • Min of Lookback Range: The minimum distance required between two pivots.

Visibility Settings

  • Plot Bullish/Hidden Bullish/Bearish/Hidden Bearish: Toggles the visibility of specific divergence types and their respective labels on the oscillator.

FAQ

How do I access RSI Divergence?

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

What is the difference between regular and hidden divergences?

Regular divergences typically signal a potential reversal in the current trend, while hidden divergences generally suggest that the prevailing trend is likely to continue.

Why do the labels appear a few bars late?

The indicator uses pivot points which require "lookback right" bars to confirm a peak or trough. This confirmation delay ensures the pivot is valid before a divergence is plotted.

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.