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
Sapphire RSI Divergence Indicator displays in a separate pane below the main chart, highlighting divergence occurrences between price movement and the RSI oscillator. Traders can configure RSI periods, pivot lookback settings, lookback ranges, and toggle specific divergence types on or off. The indicator also features up to three independent time-of-day filters to restrict signals to specific trading hours. Signals rely on right-pivot lookbacks, which confirm points after a delay.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
RSI Period
int
9
len
RSI Source
source
close
src
Pivot Lookback Right
int
3
lbR
Pivot Lookback Left
int
1
lbL
Take Profit at RSI Level
int
80
takeProfitRSILevel
Max of Lookback Range
int
60
rangeUpper
Min of Lookback Range
int
5
rangeLower
Plot Bullish
bool
true
plotBull
Plot Hidden Bullish
bool
true
plotHiddenBull
Plot Bearish
bool
true
plotBear
Plot Hidden Bearish
bool
false
plotHiddenBear
Enable Time Filter 1
bool
false
useTimeFilter1
Show all 26 settings
Setting
Type
Default
Variable
Start Hour (24-hour format)
int
0
startHour1
Start Minute
int
0
startMinute1
End Hour (24-hour format)
int
23
endHour1
End Minute
int
45
endMinute1
Enable Time Filter 2
bool
false
useTimeFilter2
Start Hour 2 (24-hour format)
int
0
startHour2
Start Minute 2
int
0
startMinute2
End Hour 2 (24-hour format)
int
23
endHour2
End Minute 2
int
45
endMinute2
Enable Time Filter 3
bool
false
useTimeFilter3
Start Hour 3 (24-hour format)
int
0
startHour3
Start Minute 3
int
0
startMinute3
End Hour 3 (24-hour format)
int
23
endHour3
End Minute 3
int
45
endMinute3
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 calculates momentum setups based on the Relative Strength Index (RSI) and plots in a separate pane. It offers multiple scanning modes such as Continuous Break, Continuous Retracement, Flip Break, Flip Retracement, and both regular and hidden div
This indicator calculates the MACD oscillator from a configurable source with fast and slow lengths, then plots the histogram, MACD line, and signal line in a separate pane. It detects regular bullish divergences (price lower lows with oscillator higher lows),
This indicator calculates the Relative Strength Index (RSI) across four user-selected timeframes and plots the results in a separate pane. It identifies regular bullish and bearish divergences between price pivot points and the primary timeframe RSI value. Add
The Bubbles Indicator measures volatility squeezes and expansion bursts using Bollinger Bands combined with a sinusoid oscillator and RSI divergence. It processes price data through scaled Bollinger Bands to highlight volatility changes while confirming trend
This indicator plots a standard Relative Strength Index (RSI) in a separate pane alongside customizable overbought and oversold threshold levels with shaded fills. It identifies pivot highs and lows on the oscillator to detect regular and hidden bullish and be
This indicator calculates a 14-period RSI from close and plots it in a separate pane with dotted overbought and dashed oversold lines at 70 and 30. It marks bullish divergence when a five-bar pivot low in price is lower than the price twenty bars earlier while