OPEN-SOURCE SCRIPT
Cập nhật RSI Median Deviation

RSI Median Deviation
Thank you to QuantumResearch for part of the code and inspiration!
Introduction:
With my first published indicator i wanted to start simple, so i created a RSI that has no static OB/OS signals and can act as a Momentum-Strength-Gauge.
Inspiration came from the Median Deviation Bands indicator by QuantumResearch!
TL;DR:
Traditional RSI says "70 is overbought" like it's a universal law. Guess what: it's not.
This indicator figures out where overbought and oversold actually are for your specific chart and timeframe, using real statistics.
What Makes it Different
Most RSI indicators slap horizontal lines at 70/30 and call it a day. Problem is, that works great... until it doesn't. In a strong trend, RSI can camp out above 70 for weeks. In choppy markets, it'll ping-pong across those levels.
RSI Median Deviation takes a smarter approach:
1. Adaptive zones that move with your data
2. Median + standard deviation bands (the 50th percentile ±2σ) that show where RSI is statistically extreme
3. Rare signals that actually mean something
4. Optional smoothed bands that adapt to current market conditions in real-time
Think of it like this: instead of asking "is RSI above 70?", we're asking "is RSI acting weird compared to its recent behavior?"
Key Features
- Statistical bands built from the RSI's actual median and standard deviation
- Multiple MA options (TEMA, WMA, HMA, ALMA, etc.) for smoothing.
- Dual detection modes: Pure stats OR MA bands
- Background highlighting when something genuinely extreme happens
- Diamond markers for ultra-rare RSI readings (<25 or >85)
- 9 color themes
- Works on all timeframes
How to Actually Use This Thing
1. Trend Bias
RSI line turns green above 60 (bullish bias), red below 47 (bearish bias).

2. Mean-Reversion Plays

Dark green background = RSI dropped below the lower 2σ band → statistically oversold
Dark magenta background = RSI spiked above the upper 2σ band → statistically overbought
3. Momentum Strength Gauge
Watch the distance between the smoothed RSI and the median line:

Wide gap = strong trend in play
Converging = momentum dying, consolidation likely
4. Extra Confirmation
Those diamond shapes at the top/bottom? That's RSI hitting <25 or >85 – genuinely extreme territory.
Recommended Settings:
RSI Length: 10
Median Length: 28
SD Length: 27
RSI MA Type: TEMA
RSI MA Length: 27
Band MA Type: WMA
Band Length: 37
The standard settings are optimized to have maximum use on all assets.
Works on everything, especially on daily or 4h charts for swing/position trading.
Last words:
RSI Median Deviation is the version that only gives signals if the ROC of your data is on the extreme side.
It'll give you fewer, better signals based on what's actually happening in the markets.
Perfect for traders who'd rather have quality over quantity.
Thank you to QuantumResearch for part of the code and inspiration!
Introduction:
With my first published indicator i wanted to start simple, so i created a RSI that has no static OB/OS signals and can act as a Momentum-Strength-Gauge.
Inspiration came from the Median Deviation Bands indicator by QuantumResearch!
TL;DR:
Traditional RSI says "70 is overbought" like it's a universal law. Guess what: it's not.
This indicator figures out where overbought and oversold actually are for your specific chart and timeframe, using real statistics.
What Makes it Different
Most RSI indicators slap horizontal lines at 70/30 and call it a day. Problem is, that works great... until it doesn't. In a strong trend, RSI can camp out above 70 for weeks. In choppy markets, it'll ping-pong across those levels.
RSI Median Deviation takes a smarter approach:
1. Adaptive zones that move with your data
2. Median + standard deviation bands (the 50th percentile ±2σ) that show where RSI is statistically extreme
3. Rare signals that actually mean something
4. Optional smoothed bands that adapt to current market conditions in real-time
Think of it like this: instead of asking "is RSI above 70?", we're asking "is RSI acting weird compared to its recent behavior?"
Key Features
- Statistical bands built from the RSI's actual median and standard deviation
- Multiple MA options (TEMA, WMA, HMA, ALMA, etc.) for smoothing.
- Dual detection modes: Pure stats OR MA bands
- Background highlighting when something genuinely extreme happens
- Diamond markers for ultra-rare RSI readings (<25 or >85)
- 9 color themes
- Works on all timeframes
How to Actually Use This Thing
1. Trend Bias
RSI line turns green above 60 (bullish bias), red below 47 (bearish bias).
2. Mean-Reversion Plays
Dark green background = RSI dropped below the lower 2σ band → statistically oversold
Dark magenta background = RSI spiked above the upper 2σ band → statistically overbought
3. Momentum Strength Gauge
Watch the distance between the smoothed RSI and the median line:
Wide gap = strong trend in play
Converging = momentum dying, consolidation likely
4. Extra Confirmation
Those diamond shapes at the top/bottom? That's RSI hitting <25 or >85 – genuinely extreme territory.
Recommended Settings:
RSI Length: 10
Median Length: 28
SD Length: 27
RSI MA Type: TEMA
RSI MA Length: 27
Band MA Type: WMA
Band Length: 37
The standard settings are optimized to have maximum use on all assets.
Works on everything, especially on daily or 4h charts for swing/position trading.
Last words:
RSI Median Deviation is the version that only gives signals if the ROC of your data is on the extreme side.
It'll give you fewer, better signals based on what's actually happening in the markets.
Perfect for traders who'd rather have quality over quantity.
Phát hành các Ghi chú
- Small update to chartPhát hành các Ghi chú
- Error in the code fixedPhát hành các Ghi chú
- Another chart fixPhát hành các Ghi chú
- Added barcoloring - Added Alerts
- Restructured and cleaned the script
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.