OPEN-SOURCE SCRIPT
RSI Divergence + Opacity

RSI + Divergences + OB/OS Opacity Fill
This indicator is a streamlined enhancement of the classic Relative Strength Index (RSI), designed to preserve the familiar TradingView RSI behavior while adding visual context for momentum extremes and potential reversals.
The script keeps the original RSI calculation and structure intact, ensuring consistent readings across all timeframes.
Features
• Standard RSI (Wilder’s RMA)
Identical calculation logic to the default TradingView RSI.
• Regular Divergence Detection
Automatically highlights:
– Bullish divergence (price lower low + RSI higher low)
– Bearish divergence (price higher high + RSI lower high)
Divergences are drawn directly on the RSI pane using minimal, unobtrusive visuals.
• Clipped Overbought / Oversold Fill
Dynamic opacity fill activates only when RSI moves beyond key levels:
– Above 70 (overbought region)
– Below 30 (oversold region)
Fill intensity increases as RSI pushes further into extremes and fades as it returns toward the threshold.
• Vertical Opacity Behavior
Color remains constant per bar; only transparency changes based on RSI distance from OB/OS levels. This avoids noisy gradients and preserves chart readability.
Design Philosophy
The goal of this script is not to reinvent RSI, but to provide clearer visual feedback for momentum conditions while keeping the indicator lightweight and predictable.
No smoothing tricks, no alternate formulas, no hidden complexity.
Notes
• Divergences use pivot-based logic and will naturally appear after pivots are confirmed.
• Like all divergence tools, signals should be interpreted within broader market context.
• Default RSI levels (70 / 30) are intentionally preserved.
This indicator is a streamlined enhancement of the classic Relative Strength Index (RSI), designed to preserve the familiar TradingView RSI behavior while adding visual context for momentum extremes and potential reversals.
The script keeps the original RSI calculation and structure intact, ensuring consistent readings across all timeframes.
Features
• Standard RSI (Wilder’s RMA)
Identical calculation logic to the default TradingView RSI.
• Regular Divergence Detection
Automatically highlights:
– Bullish divergence (price lower low + RSI higher low)
– Bearish divergence (price higher high + RSI lower high)
Divergences are drawn directly on the RSI pane using minimal, unobtrusive visuals.
• Clipped Overbought / Oversold Fill
Dynamic opacity fill activates only when RSI moves beyond key levels:
– Above 70 (overbought region)
– Below 30 (oversold region)
Fill intensity increases as RSI pushes further into extremes and fades as it returns toward the threshold.
• Vertical Opacity Behavior
Color remains constant per bar; only transparency changes based on RSI distance from OB/OS levels. This avoids noisy gradients and preserves chart readability.
Design Philosophy
The goal of this script is not to reinvent RSI, but to provide clearer visual feedback for momentum conditions while keeping the indicator lightweight and predictable.
No smoothing tricks, no alternate formulas, no hidden complexity.
Notes
• Divergences use pivot-based logic and will naturally appear after pivots are confirmed.
• Like all divergence tools, signals should be interpreted within broader market context.
• Default RSI levels (70 / 30) are intentionally preserved.
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.