OPEN-SOURCE SCRIPT
ATR-Based Z-Score (with Signal Line)

The ATR-Based Z-Score is an advanced, volatility-normalized oscillator designed to identify extreme price deviations more reliably than the standard Z-Score.
By replacing the traditional Standard Deviation with the Average True Range (ATR) in the denominator, this indicator eliminates the "volatility paradox" where rapid price spikes cause standard oscillators to prematurely return to zero, even as the price continues to crash.
Why this version is superior
In a classic Z-Score calculation:
Z = (Price - SMA) / (Standard Deviation)
A sudden impulsive price drop causes the Standard Deviation to explode. Because you are dividing by a rapidly increasing number, the Z-Score often "rises" while the price is still falling.
The ATR-Based Solution:
Z = (Price - SMA) / ATR
By using a long-period ATR as the denominator, the volatility measure remains stable and "clean." This ensures that the indicator’s troughs align much more accurately with actual price bottoms, staying in the oversold territory until the momentum truly shifts.
Key Features
How to Trade with it
1. Mean Reversion (Buy the Dip / Sell the Rip)
2. Breakout Trading
Summary
✅ This indicator is designed for traders who find standard oscillators too "nervous" during volatile periods. By decoupling price deviation from immediate variance spikes, the ATR-Based Z-Score provides a rock-solid foundation for identifying true market extremes and high-probability reversal points.
By replacing the traditional Standard Deviation with the Average True Range (ATR) in the denominator, this indicator eliminates the "volatility paradox" where rapid price spikes cause standard oscillators to prematurely return to zero, even as the price continues to crash.
Why this version is superior
In a classic Z-Score calculation:
Z = (Price - SMA) / (Standard Deviation)
A sudden impulsive price drop causes the Standard Deviation to explode. Because you are dividing by a rapidly increasing number, the Z-Score often "rises" while the price is still falling.
The ATR-Based Solution:
Z = (Price - SMA) / ATR
By using a long-period ATR as the denominator, the volatility measure remains stable and "clean." This ensures that the indicator’s troughs align much more accurately with actual price bottoms, staying in the oversold territory until the momentum truly shifts.
Key Features
- Volatility Cleaning: The ATR-normalization prevents the indicator from "flattening out" during impulsive price movements.
- Integrated Signal Line: A customizable Moving Average of the Z-Score values helps filter noise and confirms entry/exit points.
- Independent Periods: You can set the Price MA (responsiveness) and the ATR (volatility baseline) separately to fine-tune the indicator to different timeframes.
How to Trade with it
1. Mean Reversion (Buy the Dip / Sell the Rip)
- Long: Wait for the Z-Score to drop below a significant level (e.g., -10.0). Enter when the Z-Score crosses back above its Signal Line.
- Short: Wait for the Z-Score to rise above +10.0 and enter when it crosses below the Signal Line.
2. Breakout Trading
- A strong push of the Z-Score beyond the +/- 7.0 levels can indicate a powerful trend breakout.
- In this case, the Signal Line crossover serves as an effective Exit Signal, telling you that the initial momentum of the breakout is fading.
Summary
✅ This indicator is designed for traders who find standard oscillators too "nervous" during volatile periods. By decoupling price deviation from immediate variance spikes, the ATR-Based Z-Score provides a rock-solid foundation for identifying true market extremes and high-probability reversal points.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.