OPEN-SOURCE SCRIPT
Volume Clustering

This Volume Clustering script is a powerful tool for analyzing intraday trading dynamics by combining two key metrics: volume Z-Score and Cumulative Volume Delta (CVD). By categorizing market activity into distinct clusters, it helps you identify high-conviction trading opportunities and understand underlying market pressure.
How It Works
The script operates on a simple, yet effective, premise: it classifies each trading bar based on its statistical significance (volume Z-Score) and buying/selling pressure (CVD).
Volume Z-Score
The volume Z-Score measures how far the current bar's volume is from its average, helping to identify periods of unusually high or low volume. This metric is a powerful way to spot when institutional or large players might be entering the market. A high Z-Score suggests a significant event is taking place, regardless of direction.
Cumulative Volume Delta (CVD)
CVD tracks the net buying and selling pressure across different timeframes. The script uses a lower timeframe (e.g., 1-minute) and anchors it to a higher timeframe (e.g., 1-day) to capture intraday pressure. A positive CVD indicates more buying pressure, while a negative CVD suggests more selling pressure.
Cluster Categories
The script analyzes the confluence of these two metrics to assign a cluster to each bar, providing actionable insights. The clusters are color-coded and labeled to make them easy to interpret:
🟢 High Conviction Bullish: Unusually high volume (high Z-Score) combined with significant buying pressure (high CVD). This cluster suggests strong bullish momentum.
🔴 High Conviction Bearish: Unusually high volume (high Z-Score) coupled with significant selling pressure (low CVD). This cluster suggests strong bearish momentum.
🟡 Low Conviction/Noise: Low to moderate volume and mixed buying/selling pressure. This represents periods of indecision or consolidation, where market noise is more prevalent.
🟣 Other Clusters: The script also identifies other combinations, such as high volume with moderate CVD, or low volume with high CVD, which can provide additional context for understanding market dynamics.
Key Features & Customization
The script offers several customizable settings to tailor the analysis to your specific trading style:
Z-Score Lookback Length: Adjust the lookback period for calculating the average volume. A shorter period focuses on recent volume trends, while a longer period provides a broader context.
CVD Anchor & Lower Timeframe: Define the timeframes used for CVD calculation. You can anchor the analysis to a daily or weekly timeframe while using a lower timeframe (e.g., 1-minute) to capture granular intraday pressure.
High/Low Volume Mode: Toggle between "High Volume" mode (which uses 90th and 10th percentiles for clustering) and "Low Volume" mode (which uses 75th and 25th percentiles). This allows you to choose whether to focus on extreme events or more subtle shifts in market sentiment.
How It Works
The script operates on a simple, yet effective, premise: it classifies each trading bar based on its statistical significance (volume Z-Score) and buying/selling pressure (CVD).
Volume Z-Score
The volume Z-Score measures how far the current bar's volume is from its average, helping to identify periods of unusually high or low volume. This metric is a powerful way to spot when institutional or large players might be entering the market. A high Z-Score suggests a significant event is taking place, regardless of direction.
Cumulative Volume Delta (CVD)
CVD tracks the net buying and selling pressure across different timeframes. The script uses a lower timeframe (e.g., 1-minute) and anchors it to a higher timeframe (e.g., 1-day) to capture intraday pressure. A positive CVD indicates more buying pressure, while a negative CVD suggests more selling pressure.
Cluster Categories
The script analyzes the confluence of these two metrics to assign a cluster to each bar, providing actionable insights. The clusters are color-coded and labeled to make them easy to interpret:
🟢 High Conviction Bullish: Unusually high volume (high Z-Score) combined with significant buying pressure (high CVD). This cluster suggests strong bullish momentum.
🔴 High Conviction Bearish: Unusually high volume (high Z-Score) coupled with significant selling pressure (low CVD). This cluster suggests strong bearish momentum.
🟡 Low Conviction/Noise: Low to moderate volume and mixed buying/selling pressure. This represents periods of indecision or consolidation, where market noise is more prevalent.
🟣 Other Clusters: The script also identifies other combinations, such as high volume with moderate CVD, or low volume with high CVD, which can provide additional context for understanding market dynamics.
Key Features & Customization
The script offers several customizable settings to tailor the analysis to your specific trading style:
Z-Score Lookback Length: Adjust the lookback period for calculating the average volume. A shorter period focuses on recent volume trends, while a longer period provides a broader context.
CVD Anchor & Lower Timeframe: Define the timeframes used for CVD calculation. You can anchor the analysis to a daily or weekly timeframe while using a lower timeframe (e.g., 1-minute) to capture granular intraday pressure.
High/Low Volume Mode: Toggle between "High Volume" mode (which uses 90th and 10th percentiles for clustering) and "Low Volume" mode (which uses 75th and 25th percentiles). This allows you to choose whether to focus on extreme events or more subtle shifts in market sentiment.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。