OPEN-SOURCE SCRIPT
Volume Z-Score (2 StdDev)

Here's a ready-to-use description for the publish listing:
---
**Volume Z-Score (2 StdDev) — Sell-off vs. Buying Volume Outliers**
This indicator flags statistically unusual volume days by calculating a z-score: how many standard deviations today's volume is from its rolling 20-period average. Rather than relying on a fixed "unusual volume" threshold that doesn't adapt across different stocks or volatility regimes, this calculates the mean and standard deviation dynamically, so the "outlier" bar scales naturally with each symbol's own typical volume behavior.
**How it works:**
- Volume bars are plotted as columns, color-coded by both magnitude and direction:
- **Gray** — normal volume, within 2 standard deviations of the 20-period average
- **Lime green** — volume is 2+ standard deviations above average AND the bar closed up (buying/accumulation pressure)
- **Red** — volume is 2+ standard deviations above average AND the bar closed down (selling/distribution pressure)
- An orange threshold line plots the actual 2-standard-deviation level (average + 2×stdDev), so you can see the dynamic cutoff directly rather than trusting the color alone
- Two separate alert conditions are included: one for sell-off volume outliers, one for buying volume outliers, so you can set alerts independently for either direction
**How to use it:**
Best paired with a volatility-compression indicator like the TTM Squeeze — a squeeze release confirmed by a same-day green (or red) volume outlier here is a stronger signal than a squeeze release with unremarkable volume. Works on any timeframe and any symbol; the 20-period lookback can be adjusted in settings to suit shorter or longer-term analysis.
**Settings:**
- Lookback Length (default 20) — the period used to calculate the rolling average and standard deviation of volume
**Disclaimer:** This is a volatility/volume analysis tool, not a standalone trading system. It does not predict direction with certainty and should be combined with price action, trend context, and proper risk management. Past patterns do not guarantee future results.
---
**Volume Z-Score (2 StdDev) — Sell-off vs. Buying Volume Outliers**
This indicator flags statistically unusual volume days by calculating a z-score: how many standard deviations today's volume is from its rolling 20-period average. Rather than relying on a fixed "unusual volume" threshold that doesn't adapt across different stocks or volatility regimes, this calculates the mean and standard deviation dynamically, so the "outlier" bar scales naturally with each symbol's own typical volume behavior.
**How it works:**
- Volume bars are plotted as columns, color-coded by both magnitude and direction:
- **Gray** — normal volume, within 2 standard deviations of the 20-period average
- **Lime green** — volume is 2+ standard deviations above average AND the bar closed up (buying/accumulation pressure)
- **Red** — volume is 2+ standard deviations above average AND the bar closed down (selling/distribution pressure)
- An orange threshold line plots the actual 2-standard-deviation level (average + 2×stdDev), so you can see the dynamic cutoff directly rather than trusting the color alone
- Two separate alert conditions are included: one for sell-off volume outliers, one for buying volume outliers, so you can set alerts independently for either direction
**How to use it:**
Best paired with a volatility-compression indicator like the TTM Squeeze — a squeeze release confirmed by a same-day green (or red) volume outlier here is a stronger signal than a squeeze release with unremarkable volume. Works on any timeframe and any symbol; the 20-period lookback can be adjusted in settings to suit shorter or longer-term analysis.
**Settings:**
- Lookback Length (default 20) — the period used to calculate the rolling average and standard deviation of volume
**Disclaimer:** This is a volatility/volume analysis tool, not a standalone trading system. It does not predict direction with certainty and should be combined with price action, trend context, and proper risk management. Past patterns do not guarantee future results.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.