RSI Divergence_overlay
Mar 13, 2022

The RSI Divergence_overlay indicator identifies potential trend reversals by detecting divergences between price action and the Relative Strength Index (RSI) directly on the price chart. This tool provides a visual representation of momentum shifts without needing to occupy additional space in a separate oscillator pane.
Usage
The Usage section focuses on identifying momentum exhaustion through price and RSI discrepancies.
- Bullish Divergence: Indicated by a green triangle below the candle. This occurs when price makes a lower low while the RSI makes a higher low, suggesting selling pressure is weakening.
- Bearish Divergence: Indicated by a red triangle above the candle. This occurs when price makes a higher high while the RSI makes a lower high, suggesting buying pressure is fading.
To use the indicator effectively, traders should look for these signals at key support or resistance levels. Note that signals appear with a delay defined by the "Pivot Rightbars" setting, as the script must confirm a pivot point before plotting.
Details
This script calculates internal RSI values based on the user-defined period. It utilizes a pivot-based detection method where it compares the current pivot high or low with historical pivots. The "Lookback Level" determines how many previous pivots the script evaluates to find a divergence. This multi-level approach allows the indicator to catch complex divergence patterns that span across multiple price swings.
Settings
RSI DIV SETTING
- RSI Period: Sets the lookback period for the internal RSI calculation (default is 14).
- Pivot Leftbars: The number of bars required to the left of a high or low to confirm a pivot.
- Pivot Rightbars: The number of bars required to the right to confirm a pivot. This also determines the signal offset.
- Bearish Divs_Pivot Source: The price source used to determine bearish divergence pivots (e.g., Close, High).
- Bullish Divs_Pivot Source: The price source used to determine bullish divergence pivots (e.g., Close, Low).
- Lookback Level_Divs: Determines the depth of the search for historical pivots (1–5). Higher levels look further back for divergences.
- Divergence On / Off Switch: Toggles the visibility of the divergence signals on the chart.
FAQ
How do I access RSI Divergence_overlay?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Why do the signals appear a few bars late?
The signals rely on pivot detection, which requires a specific number of bars to the right (Pivot Rightbars) to confirm that a peak or trough has indeed been formed.
Does this include the RSI oscillator at the bottom?
No, this is an "overlay" script designed to show signals directly on the price candles. You can add the standard RSI indicator separately if you wish to see the oscillator line.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.