OPEN-SOURCE SCRIPT
ATR Deviation Oscillator

ATR Deviation Oscillator
The ATR Deviation Oscillator is a simple ATR-based volatility, price deviation, and market momentum indicator that measures how far price has moved away from its moving average, normalized by Average True Range (ATR).
Instead of using raw price distance, it shows the deviation in ATR units, making it easier to identify price expansion, volatility, trend strength, momentum, overextension, and potential mean-reversion areas across different market conditions.
How It Works
The core calculation is:
(Price - Moving Average) / ATR
This produces a normalized oscillator centered around zero.
0 — Price is at the moving average.
Positive values — Price is above the baseline.
Negative values — Price is below the baseline.
+1 / -1 ATR — Price is approximately 1 ATR from the baseline.
+2 / -2 ATR — Price is approximately 2 ATR from the baseline.
+3 / -3 ATR — Price is approximately 3 ATR from the baseline.
ATR Deviation Levels
The 1, 2, and 3 ATR levels help visualize how extended price is relative to its current volatility.
Higher readings can indicate strong price momentum, trend expansion, volatility expansion, or overextension.
Lower readings can indicate downside momentum, trend weakness, volatility expansion, or potential oversold/mean-reversion conditions.
These levels are not fixed percentage thresholds. They automatically adapt to current market volatility through ATR.
Moving Average Options
Choose from:
SMA — Simple Moving Average
EMA — Exponential Moving Average
RMA — Relative Moving Average
WMA — Weighted Moving Average
VWMA — Volume Weighted Moving Average
This allows the oscillator to be adapted to different trading strategies, market conditions, timeframes, and instruments.
What You Can Use It For
The ATR Deviation Oscillator can help with:
ATR volatility analysis
Price deviation analysis
Trend strength
Momentum analysis
Market overextension
Mean reversion
Volatility expansion
Breakout analysis
Pullback analysis
Moving average distance
Price momentum
Trend continuation
Potential reversal zones
Overbought and oversold conditions
Market regime analysis
The indicator can be useful for Forex, Gold, Crypto, Stocks, Indices, Futures, and other liquid markets.
Important
The ATR Deviation Oscillator is a market analysis tool, not a standalone buy or sell signal. Extreme deviation does not automatically mean price will reverse. Strong trends can remain extended for long periods.
Use the oscillator together with price action, market structure, trend analysis, support and resistance, volatility, and your existing trading strategy.
The ATR Deviation Oscillator is a simple ATR-based volatility, price deviation, and market momentum indicator that measures how far price has moved away from its moving average, normalized by Average True Range (ATR).
Instead of using raw price distance, it shows the deviation in ATR units, making it easier to identify price expansion, volatility, trend strength, momentum, overextension, and potential mean-reversion areas across different market conditions.
How It Works
The core calculation is:
(Price - Moving Average) / ATR
This produces a normalized oscillator centered around zero.
0 — Price is at the moving average.
Positive values — Price is above the baseline.
Negative values — Price is below the baseline.
+1 / -1 ATR — Price is approximately 1 ATR from the baseline.
+2 / -2 ATR — Price is approximately 2 ATR from the baseline.
+3 / -3 ATR — Price is approximately 3 ATR from the baseline.
ATR Deviation Levels
The 1, 2, and 3 ATR levels help visualize how extended price is relative to its current volatility.
Higher readings can indicate strong price momentum, trend expansion, volatility expansion, or overextension.
Lower readings can indicate downside momentum, trend weakness, volatility expansion, or potential oversold/mean-reversion conditions.
These levels are not fixed percentage thresholds. They automatically adapt to current market volatility through ATR.
Moving Average Options
Choose from:
SMA — Simple Moving Average
EMA — Exponential Moving Average
RMA — Relative Moving Average
WMA — Weighted Moving Average
VWMA — Volume Weighted Moving Average
This allows the oscillator to be adapted to different trading strategies, market conditions, timeframes, and instruments.
What You Can Use It For
The ATR Deviation Oscillator can help with:
ATR volatility analysis
Price deviation analysis
Trend strength
Momentum analysis
Market overextension
Mean reversion
Volatility expansion
Breakout analysis
Pullback analysis
Moving average distance
Price momentum
Trend continuation
Potential reversal zones
Overbought and oversold conditions
Market regime analysis
The indicator can be useful for Forex, Gold, Crypto, Stocks, Indices, Futures, and other liquid markets.
Important
The ATR Deviation Oscillator is a market analysis tool, not a standalone buy or sell signal. Extreme deviation does not automatically mean price will reverse. Strong trends can remain extended for long periods.
Use the oscillator together with price action, market structure, trend analysis, support and resistance, volatility, and your existing trading strategy.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.