OPEN-SOURCE SCRIPT
Adaptive RSI ZScore

Adaptive RSI ZScore
Adaptive RSI ZScore is a normalized momentum oscillator that measures the statistical deviation of the RSI from its own moving average, expressed as a Z-Score. Rather than reading momentum on an absolute scale like traditional RSI, it shows how unusual the current momentum state is relative to its own historical behavior — making it self-adjusting across different market conditions.
The result is an oscillator that turns blue when momentum is unusually strong and red when momentum is unusually weak — always relative to its own recent history, not fixed overbought/oversold levels.
How It Works
The RSI is calculated on a configurable source and length. A moving average of the RSI is then computed using a separately configurable MA length and type — allowing the smoothing behavior to be tuned independently from the RSI calculation itself. The Z-Score is derived from the difference between the RSI and its moving average, normalized by the standard deviation of the RSI.
When the Z-Score crosses above the Long Threshold a bullish state is confirmed. When it crosses below the Short Threshold a bearish state is confirmed. The state persists until the opposite condition is met.
Why Dynamic Thresholds Matter
Fixed thresholds work well in stable market conditions but struggle in highly volatile environments — a Z-Score move that would be significant in a calm market may be completely normal during high volatility. The Dynamic Threshold feature solves this by automatically adjusting the Long and Short thresholds based on the current standard deviation of the Z-Score itself. This means the indicator always requires an equally significant statistical deviation to trigger a signal, regardless of how volatile the market currently is.
This makes the indicator particularly well suited for volatile assets where market conditions shift frequently and fixed thresholds would quickly become unreliable. By default Dynamic Thresholds are enabled. They can be disabled in favor of fixed manual thresholds if preferred.
Settings
How to trade it
Recommended Usage
All signals are confirmed on bar close.
Adaptive RSI ZScore is a normalized momentum oscillator that measures the statistical deviation of the RSI from its own moving average, expressed as a Z-Score. Rather than reading momentum on an absolute scale like traditional RSI, it shows how unusual the current momentum state is relative to its own historical behavior — making it self-adjusting across different market conditions.
The result is an oscillator that turns blue when momentum is unusually strong and red when momentum is unusually weak — always relative to its own recent history, not fixed overbought/oversold levels.
How It Works
The RSI is calculated on a configurable source and length. A moving average of the RSI is then computed using a separately configurable MA length and type — allowing the smoothing behavior to be tuned independently from the RSI calculation itself. The Z-Score is derived from the difference between the RSI and its moving average, normalized by the standard deviation of the RSI.
When the Z-Score crosses above the Long Threshold a bullish state is confirmed. When it crosses below the Short Threshold a bearish state is confirmed. The state persists until the opposite condition is met.
Why Dynamic Thresholds Matter
Fixed thresholds work well in stable market conditions but struggle in highly volatile environments — a Z-Score move that would be significant in a calm market may be completely normal during high volatility. The Dynamic Threshold feature solves this by automatically adjusting the Long and Short thresholds based on the current standard deviation of the Z-Score itself. This means the indicator always requires an equally significant statistical deviation to trigger a signal, regardless of how volatile the market currently is.
This makes the indicator particularly well suited for volatile assets where market conditions shift frequently and fixed thresholds would quickly become unreliable. By default Dynamic Thresholds are enabled. They can be disabled in favor of fixed manual thresholds if preferred.
Settings
- RSI Length — Lookback period for RSI calculation (default: 39)
- MA Length — Lookback period for the moving average and standard deviation (default: 37)
- Source — Price source for RSI calculation (default: open)
- MA Type — Moving average type used to calculate the RSI mean: SMA, EMA, WMA, RMA, HMA, VWMA (default: SMA)
- Long Threshold — Z-Score level for bullish confirmation when dynamic thresholds are disabled (default: 0.85)
- Short Threshold — Z-Score level for bearish confirmation when dynamic thresholds are disabled (default: -1.71)
- Use Dynamic Thresholds — Enables adaptive thresholds based on Z-Score standard deviation (default: true)
- Long SD Multiplier — Controls the sensitivity of the dynamic long threshold (default: 1.1)
- Short SD Multiplier — Controls the sensitivity of the dynamic short threshold (default: 1.3)
- Use Bar Coloring — Colors bars based on the current state (default: true)
- Color Background — Colors the chart background based on the current state (default: false)
- Background Transparency — Controls the transparency of the background color (default: 85)
How to trade it
- Long — when the oscillator turns blue the momentum state is statistically unusually strong. This is the signal to look for long entries or to hold existing long positions
- Short / Cash — when the oscillator turns red the momentum state has weakened significantly. This is the signal to exit longs, move to cash, or look for short entries depending on your strategy
- Avoid trading against the signal — if the oscillator is red do not look for longs, if it is blue do not look for shorts
Recommended Usage
- Best used on the 1D timeframe — the statistical deviation signals are cleaner and more reliable on higher timeframes where noise is reduced
- Designed to be used as a confirmation filter alongside a trend-following indicator — it identifies statistically significant momentum shifts that support or contradict the prevailing trend
- Should not be used alone for trade entries — combine with a structural or trend filter for best results
- Separating RSI Length and MA Length allows fine-tuning of signal sensitivity independently from smoothing behavior
- Dynamic Thresholds are recommended for volatile markets and assets — disable them for more stable and predictable signals
- Use the Long and Short SD Multipliers to control how extreme the momentum deviation must be before a signal fires — higher values mean fewer but higher quality signals
All signals are confirmed on bar close.
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.
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.