The RSI Divergence Scanner calculates the Relative Strength Index and identifies regular and hidden bullish or bearish divergences against price using pivot high and low points.
1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.
Overview
RSI Divergence Scanner plots divergence lines and customizable labels directly on the price chart. Inputs allow tuning of RSI length, overbought and oversold thresholds, pivot lookback windows, and minimum bar distance between pivots. Configurable alerts notify users upon divergence confirmation. Note that pivot detection requires a lookback delay, so signals appear a fixed number of bars after the pivot occurs.
Regular and hidden RSI divergence detection
Visual divergence lines and chart labels
Customizable pivot lookback and spacing parameters
Configurable alert toggles for bullish and bearish signals
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
RSI Length
int
14
rsi_length
Divergence Lookback
int
5
divergence_lookback
Min Bars Between Pivots
int
3
min_bars_between
RSI Overbought
float
70.0
rsi_overbought
RSI Oversold
float
30.0
rsi_oversold
Show RSI Divergence Lines
bool
true
show_rsi_lines
Show Price Divergence Lines
bool
true
show_price_lines
Show Divergence Labels
bool
true
show_labels
Line Extension
int
5
line_extend
Alert Bullish Divergence
bool
true
alert_bullish
Alert Bearish Divergence
bool
true
alert_bearish
Alert Hidden Divergence
bool
false
alert_hidden
Show all 16 settings
Setting
Type
Default
Variable
Bullish Divergence
color
color.green
bull_div_color
Bearish Divergence
color
color.red
bear_div_color
Hidden Bullish
color
color.blue
hidden_bull_color
Hidden Bearish
color
color.orange
hidden_bear_color
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This indicator scans multiple tickers simultaneously to detect regular bullish and bearish MACD divergences filtered by long-term trend direction (150 EMA versus 600 EMA). It evaluates pivot highs and lows in the MACD line against price action across configura
This overlay indicator looks for regular price divergences against a set of oscillators, using pivot highs and lows. It compares those pivots with RSI, MACD and its histogram, stochastic, CCI, momentum, OBV, a directional oscillator, volume-weighted MACD, Chai
This indicator detects regular and hidden divergences across multiple technical factors plotted directly on the price chart. It evaluates price highs and lows against peaks and troughs identified by a five-bar fractal mechanism on RSI, RSI Stochastic, MACD, re
This indicator marks RSI divergences only when price trades beyond daily VWAP standard-deviation bands. It compares recent RSI extremes with price highs and lows over a lookback window, and it treats a divergence as valid only while RSI stays beyond overbought
This indicator builds a momentum score from the rate of change of close, using a lookback that expands or contracts with ATR relative to its standard deviation. It divides that rate of change by price standard deviation, scales the result, and weights it by vo
This indicator collection calculates and plots previous daily high and low price levels on the chart to identify potential supply and demand zones. It includes real-time intraday high and low calculations, RSI divergence detection across a customizable period