OPEN-SOURCE SCRIPT
Aggiornato cd_RSI_Divergence_Cx

General:
The Relative Strength Index (RSI) is a momentum oscillator widely used by traders in price analysis. In addition to showing overbought/oversold zones, divergences between RSI and price are also tracked to identify trading opportunities.
The general consensus is that oscillators alone are not sufficient for entries and should be evaluated together with multiple confirmations.
This oscillator is designed as an additional confirmation/compatible tool for strategies that already use higher time frame (HTF) sweeps and lower time frame (LTF) confirmations such as Change in State Delivery (CISD) or Change of Character (CHOCH).
Features:
While RSI oscillators are commonly displayed in line format (classic), this indicator also offers candlestick-style visualization.
Depending on the selected source, period length, and EMA length, RSI can be displayed as lines and/or candlesticks.

Divergence detection & tracking:
Price and RSI values are monitored on the chosen higher time frame (from the menu) to determine highs and lows. For divergence display, the user can choose between two modes:
1- Alignment with HTF Sweep
2- All
1 - Alignment with HTF Sweep:
First, the price must sweep the previous high/low of the candle on the HTF (i.e., break it) but fail to continue in that direction and return inside (sweep).
If this condition is met, RSI values are checked:
If price makes a high sweep but RSI fails to make a new high → divergence is confirmed.
If price makes a low sweep but RSI fails to make a new low → divergence is confirmed.
Divergence is then displayed on the chart.
2 - All:
In this mode, sweep conditions are ignored. Divergence is confirmed if:
Price makes a new high on HTF but RSI does not.
RSI makes a new high on HTF but price does not.
Price makes a new low on HTF but RSI does not.
RSI makes a new low on HTF but price does not.
Menu & Settings:
RSI visualization (source + period length + EMA period length)
Option to choose classic/candlestick style display
Color customization
Higher time frame selection
Adjustable HTF boxes and table display

Final notes:
This oscillator is designed as an additional confirmation tool for strategies based on HTF sweep + LTF CISD/CHOCH confirmation logic. The chosen HTF in the oscillator should match the time frame where sweeps are expected.
Divergence signals from this oscillator alone will not make you profitable.
For spot trades, monitoring sweeps and divergences on higher time frames is more suitable (e.g., Daily–H1 / Weekly–H4).
My personal usage preferences:
Entry TF: 3m
HTF bias: Daily + H1
Sweep + CISD: 30m / 3m
Market Structure: 3m
RSI divergence: HTF = 30m
If all of them align bullish or bearish (timeframe alignment), I try to take the trade.
I’d be glad to hear your feedback and suggestions for improvement.
Happy trading!
The Relative Strength Index (RSI) is a momentum oscillator widely used by traders in price analysis. In addition to showing overbought/oversold zones, divergences between RSI and price are also tracked to identify trading opportunities.
The general consensus is that oscillators alone are not sufficient for entries and should be evaluated together with multiple confirmations.
This oscillator is designed as an additional confirmation/compatible tool for strategies that already use higher time frame (HTF) sweeps and lower time frame (LTF) confirmations such as Change in State Delivery (CISD) or Change of Character (CHOCH).
Features:
While RSI oscillators are commonly displayed in line format (classic), this indicator also offers candlestick-style visualization.
Depending on the selected source, period length, and EMA length, RSI can be displayed as lines and/or candlesticks.
Divergence detection & tracking:
Price and RSI values are monitored on the chosen higher time frame (from the menu) to determine highs and lows. For divergence display, the user can choose between two modes:
1- Alignment with HTF Sweep
2- All
1 - Alignment with HTF Sweep:
First, the price must sweep the previous high/low of the candle on the HTF (i.e., break it) but fail to continue in that direction and return inside (sweep).
If this condition is met, RSI values are checked:
If price makes a high sweep but RSI fails to make a new high → divergence is confirmed.
If price makes a low sweep but RSI fails to make a new low → divergence is confirmed.
Divergence is then displayed on the chart.
2 - All:
In this mode, sweep conditions are ignored. Divergence is confirmed if:
Price makes a new high on HTF but RSI does not.
RSI makes a new high on HTF but price does not.
Price makes a new low on HTF but RSI does not.
RSI makes a new low on HTF but price does not.
Menu & Settings:
RSI visualization (source + period length + EMA period length)
Option to choose classic/candlestick style display
Color customization
Higher time frame selection
Adjustable HTF boxes and table display
Final notes:
This oscillator is designed as an additional confirmation tool for strategies based on HTF sweep + LTF CISD/CHOCH confirmation logic. The chosen HTF in the oscillator should match the time frame where sweeps are expected.
Divergence signals from this oscillator alone will not make you profitable.
For spot trades, monitoring sweeps and divergences on higher time frames is more suitable (e.g., Daily–H1 / Weekly–H4).
My personal usage preferences:
Entry TF: 3m
HTF bias: Daily + H1
Sweep + CISD: 30m / 3m
Market Structure: 3m
RSI divergence: HTF = 30m
If all of them align bullish or bearish (timeframe alignment), I try to take the trade.
I’d be glad to hear your feedback and suggestions for improvement.
Happy trading!
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.