OPEN-SOURCE SCRIPT
RSI Divergence Detector - HDAlgo

RSI Divergence Detector — Automatically Spot Reversal & Continuation Signals
This indicator automatically detects Regular and Hidden RSI Divergences and plots them directly on the RSI panel with visual lines and labels.
What It Detects
Regular Divergence (Reversal Signals):
Bullish Divergence — Price makes a lower low, but RSI makes a higher low. This signals weakening selling pressure and a potential reversal to the upside.
Bearish Divergence — Price makes a higher high, but RSI makes a lower high. This signals weakening buying pressure and a potential reversal to the downside.
Hidden Divergence (Trend Continuation Signals):
Hidden Bullish — Price makes a higher low, but RSI makes a lower low. Suggests the uptrend is likely to continue.
Hidden Bearish — Price makes a lower high, but RSI makes a higher high. Suggests the downtrend is likely to continue.
Visual Guide
🟢 Green label "Bull" + solid green line = Regular Bullish Divergence
🔴 Red label "Bear" + solid red line = Regular Bearish Divergence
🔺 Lime triangle + dashed line = Hidden Bullish Divergence
🔻 Orange triangle + dashed line = Hidden Bearish Divergence
Settings
RSI Length — Default 14. Standard RSI period.
Pivot Lookback Left / Right — Controls how significant a pivot must be. Higher = fewer but stronger signals.
Min / Max Bars Between Pivots — Filters out divergences that are too close or too far apart.
Show Bullish / Bearish / Hidden — Toggle each divergence type on or off.
How to Use
For reversals: Look for Regular Bullish Divergence near support zones or Regular Bearish Divergence near resistance zones.
For trend continuation: Enable Hidden Divergence to confirm that the current trend is still intact.
Best combined with: Stochastic crossover in oversold/overbought zones, volume confirmation, and key support/resistance levels from higher timeframes.
Alerts
Built-in alert conditions for all 4 divergence types — set them up via TradingView's alert menu so you never miss a signal.
Note: Divergence is not a standalone signal. Always confirm with price action, volume, and other confluence factors before entering a trade. This indicator has a natural delay of Pivot Lookback Right bars to confirm pivots.
This indicator automatically detects Regular and Hidden RSI Divergences and plots them directly on the RSI panel with visual lines and labels.
What It Detects
Regular Divergence (Reversal Signals):
Bullish Divergence — Price makes a lower low, but RSI makes a higher low. This signals weakening selling pressure and a potential reversal to the upside.
Bearish Divergence — Price makes a higher high, but RSI makes a lower high. This signals weakening buying pressure and a potential reversal to the downside.
Hidden Divergence (Trend Continuation Signals):
Hidden Bullish — Price makes a higher low, but RSI makes a lower low. Suggests the uptrend is likely to continue.
Hidden Bearish — Price makes a lower high, but RSI makes a higher high. Suggests the downtrend is likely to continue.
Visual Guide
🟢 Green label "Bull" + solid green line = Regular Bullish Divergence
🔴 Red label "Bear" + solid red line = Regular Bearish Divergence
🔺 Lime triangle + dashed line = Hidden Bullish Divergence
🔻 Orange triangle + dashed line = Hidden Bearish Divergence
Settings
RSI Length — Default 14. Standard RSI period.
Pivot Lookback Left / Right — Controls how significant a pivot must be. Higher = fewer but stronger signals.
Min / Max Bars Between Pivots — Filters out divergences that are too close or too far apart.
Show Bullish / Bearish / Hidden — Toggle each divergence type on or off.
How to Use
For reversals: Look for Regular Bullish Divergence near support zones or Regular Bearish Divergence near resistance zones.
For trend continuation: Enable Hidden Divergence to confirm that the current trend is still intact.
Best combined with: Stochastic crossover in oversold/overbought zones, volume confirmation, and key support/resistance levels from higher timeframes.
Alerts
Built-in alert conditions for all 4 divergence types — set them up via TradingView's alert menu so you never miss a signal.
Note: Divergence is not a standalone signal. Always confirm with price action, volume, and other confluence factors before entering a trade. This indicator has a natural delay of Pivot Lookback Right bars to confirm pivots.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.