OPEN-SOURCE SCRIPT
RSI Divergence Confirmation

About This Script
RSI Divergence Confirmation identifies regular and hidden bullish and bearish divergences between price and the Relative Strength Index.
The indicator uses confirmed RSI pivot highs and lows as the anchor points for divergence detection. Price comparisons are based on the candle body, not the wick:
Bullish divergences use the lower body value: min(open, close).
Bearish divergences use the upper body value: max(open, close).
Divergence Types
Regular bullish: Price forms a lower body low while RSI forms a higher low.
Hidden bullish: Price forms a higher body low while RSI forms a lower low.
Regular bearish: Price forms a higher body high while RSI forms a lower high.
Hidden bearish: Price forms a lower body high while RSI forms a higher high.
Confirmation Arrows
A divergence is confirmed only when the first opposite-colored candle appears after the divergence setup:
Bullish divergence requires the first bullish candle.
Bearish divergence requires the first bearish candle.
That candle must have a body strictly larger than the previous candle’s body. If the first opposite candle fails this condition, a later candle cannot replace it.
Visual Features
Solid lines represent regular divergences.
Dashed lines represent hidden divergences.
Divergence lines are displayed on both the price chart and the RSI pane.
Price divergence lines are anchored using candle-body values rather than wick extremes.
Alert conditions are available for confirmed bullish and bearish divergences.
Pivot confirmation introduces a delay based on the selected right-pivot setting. Lower pivot values provide faster but more sensitive signals, while higher values produce fewer and more selective divergences. This indicator is intended as an analytical and alerting tool; it does not place trades.
RSI Divergence Confirmation identifies regular and hidden bullish and bearish divergences between price and the Relative Strength Index.
The indicator uses confirmed RSI pivot highs and lows as the anchor points for divergence detection. Price comparisons are based on the candle body, not the wick:
Bullish divergences use the lower body value: min(open, close).
Bearish divergences use the upper body value: max(open, close).
Divergence Types
Regular bullish: Price forms a lower body low while RSI forms a higher low.
Hidden bullish: Price forms a higher body low while RSI forms a lower low.
Regular bearish: Price forms a higher body high while RSI forms a lower high.
Hidden bearish: Price forms a lower body high while RSI forms a higher high.
Confirmation Arrows
A divergence is confirmed only when the first opposite-colored candle appears after the divergence setup:
Bullish divergence requires the first bullish candle.
Bearish divergence requires the first bearish candle.
That candle must have a body strictly larger than the previous candle’s body. If the first opposite candle fails this condition, a later candle cannot replace it.
Visual Features
Solid lines represent regular divergences.
Dashed lines represent hidden divergences.
Divergence lines are displayed on both the price chart and the RSI pane.
Price divergence lines are anchored using candle-body values rather than wick extremes.
Alert conditions are available for confirmed bullish and bearish divergences.
Pivot confirmation introduces a delay based on the selected right-pivot setting. Lower pivot values provide faster but more sensitive signals, while higher values produce fewer and more selective divergences. This indicator is intended as an analytical and alerting tool; it does not place trades.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.