OPEN-SOURCE SCRIPT
Dynamic Range RSI [DefinedEdge]

🔍 OVERVIEW
Really excited to release this one. I've been working on this for a while and it solves something that always bugged me about RSI: the fixed lookback period. Markets don't move at one speed, so why should your oscillator?
Dynamic Range RSI rethinks the standard RSI by replacing the fixed lookback with a volatility-adaptive engine. The indicator reads the current ATR regime and automatically adjusts its period. Shorter when markets are volatile, longer when they're quiet. No manual switching, no lag when it matters.
It also layers in divergence detection and a higher-timeframe confluence ribbon so you're not trading the oscillator in isolation.
⚙️ HOW IT WORKS
The core calculation uses a range-normalized momentum formula instead of standard RSI math. Price changes are weighted by the current high-low range, which makes the output cleaner during trending moves and less prone to false signals during chop.
The adaptive length is driven by an ATR ratio (fast ATR vs slow ATR). When volatility spikes, the RSI period compresses toward the minimum. When volatility drops, it stretches toward the maximum. Responsive during breakouts, smooth during consolidation.
🎯 FEATURES
→ ATR-adaptive RSI length (user-defined min/max range)
→ Range-normalized momentum calculation
→ 4 smoothing methods: EMA, SMA, RMA, TMA
→ Automatic divergence detection (pivot-based, configurable lookback)
→ Higher-timeframe confluence ribbon (auto or manual HTF selection)
→ Signal line crossover dots filtered to OB/OS zones only
→ 6 built-in alert conditions
→ Dynamic length visible in status line
📊 SIGNALS
• Green circles: signal line cross up inside oversold zone
• Red circles: signal line cross down inside overbought zone
• "Bull" labels: bullish divergence (price lower low, RSI higher low)
• "Bear" labels: bearish divergence (price higher high, RSI lower high)
• Background shading: HTF ribbon turns green/red when the higher timeframe agrees on OB/OS
💡 USAGE TIPS
Works on any market, any timeframe. For crypto I like the 4H. The adaptive length flexes between roughly 1 to 5 days of lookback which catches momentum shifts well. For scalping, 15min with HTF pulling from 4H gives solid confluence.
If the dynamic length stays pinned at minimum too often, bump the Min Length up to 8-10 to smooth it out.
Really excited to release this one. I've been working on this for a while and it solves something that always bugged me about RSI: the fixed lookback period. Markets don't move at one speed, so why should your oscillator?
Dynamic Range RSI rethinks the standard RSI by replacing the fixed lookback with a volatility-adaptive engine. The indicator reads the current ATR regime and automatically adjusts its period. Shorter when markets are volatile, longer when they're quiet. No manual switching, no lag when it matters.
It also layers in divergence detection and a higher-timeframe confluence ribbon so you're not trading the oscillator in isolation.
⚙️ HOW IT WORKS
The core calculation uses a range-normalized momentum formula instead of standard RSI math. Price changes are weighted by the current high-low range, which makes the output cleaner during trending moves and less prone to false signals during chop.
The adaptive length is driven by an ATR ratio (fast ATR vs slow ATR). When volatility spikes, the RSI period compresses toward the minimum. When volatility drops, it stretches toward the maximum. Responsive during breakouts, smooth during consolidation.
🎯 FEATURES
→ ATR-adaptive RSI length (user-defined min/max range)
→ Range-normalized momentum calculation
→ 4 smoothing methods: EMA, SMA, RMA, TMA
→ Automatic divergence detection (pivot-based, configurable lookback)
→ Higher-timeframe confluence ribbon (auto or manual HTF selection)
→ Signal line crossover dots filtered to OB/OS zones only
→ 6 built-in alert conditions
→ Dynamic length visible in status line
📊 SIGNALS
• Green circles: signal line cross up inside oversold zone
• Red circles: signal line cross down inside overbought zone
• "Bull" labels: bullish divergence (price lower low, RSI higher low)
• "Bear" labels: bearish divergence (price higher high, RSI lower high)
• Background shading: HTF ribbon turns green/red when the higher timeframe agrees on OB/OS
💡 USAGE TIPS
Works on any market, any timeframe. For crypto I like the 4H. The adaptive length flexes between roughly 1 to 5 days of lookback which catches momentum shifts well. For scalping, 15min with HTF pulling from 4H gives solid confluence.
If the dynamic length stays pinned at minimum too often, bump the Min Length up to 8-10 to smooth it out.
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.