OPEN-SOURCE SCRIPT
Atualizado 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.
Notas de Lançamento
- Small update to chartNotas de Lançamento
- Error in the code fixedNotas de Lançamento
- Another chart fixScript de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.