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.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。