RSI + Div
May 25, 2021

The RSI + Div indicator provides a streamlined approach to Relative Strength Index (RSI) analysis by automatically detecting and highlighting price-momentum divergences. It combines standard RSI oscillations with advanced logic to identify bullish and bearish divergences, helping traders spot potential trend reversals and momentum shifts.
Usage
The tool can be used to identify overextended market conditions and potential trend exhaustion.
- Divergence Detection: When price makes a higher high but the RSI makes a lower high, a red line and diamond appear, indicating bearish divergence. Conversely, when price makes a lower low but RSI makes a higher low, a green line and diamond appear, indicating bullish divergence.
- Overbought/Oversold Conditions: The indicator highlights areas where the RSI exceeds the Overbuy (default 70) or falls below the Oversell (default 30) levels using background coloring and fills.
- Trend Filtering: An optional EMA can be plotted over the RSI to help smooth out noise and determine the short-term direction of momentum.
Details
The script identifies "Master" tops and bottoms based on specific threshold limits (Overbuy/Oversell). Once a master peak or trough is established, the indicator looks for subsequent peaks or troughs that contradict the price action.
- Confirmation: The logic uses a confirmation delay to ensure pivots are valid before plotting.
- Price Source: Users can toggle between using "High/Low" or "Close" for price comparison, allowing for flexibility depending on whether the trader prioritizes wick-based or body-based divergences.
Settings
RSI
- RSI Length: Determines the lookback period for the RSI calculation.
- Show 50 line: Toggles the visibility of the median 50 level.
EMA
- Show EMA: Toggles the visibility of the smoothing EMA.
- EMA Length: Sets the period for the RSI smoothing moving average.
Overbuy - Oversell
- Overbuy/Oversell: Defines the levels used for extreme momentum detection.
- Fill overbuy / oversell area: Fills the space between the RSI line and the boundary levels.
- Plot background: Colors the chart background when RSI is in extreme zones.
Divergence
- Price top / bot source: Choose between High/Low or Close for divergence price references.
- Loopback/Confirmation: Controls the sensitivity of pivot detection.
- Top/Bottom Detection Limit: Minimum/Maximum RSI values required to qualify a pivot for divergence analysis.
- Max Divergence Loopback: The maximum number of bars allowed between two peaks/troughs to form a valid divergence.
FAQ
How do I use the RSI + Div for entries?
Traders typically look for bullish divergences at the end of a downtrend or bearish divergences at the peak of an uptrend as signals for potential reversals, often confirming with other technical analysis tools.
What is the "Confirmation" setting?
The confirmation setting introduces a small delay to ensure a local top or bottom in the RSI has actually formed before the divergence is plotted on the chart.
How can I access this script?
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.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.