OPEN-SOURCE SCRIPT
מעודכן

Volume Clustering

635
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.
הערות שחרור
This advanced Pine Script® indicator provides a granular, 9-tier classification of market activity by combining the statistical significance of Volume Z-Score and Cumulative Volume Delta (CVD) Z-Score. It's designed to help traders cut through market noise and identify high-conviction opportunities, absorption, or quiet accumulation/distribution.

🧠 Core Mechanics: Z-Scores and Percentiles
The script analyzes two key factors using a rolling lookback window (default 40 bars) to ensure statistical relevance:

Volume Z-Score (zVolume): Measures how many standard deviations the current bar's volume is from the recent average. This categorizes the volume into three tiers: HIGH, MODERATE, or LOW (using the 75th and 25th percentiles as thresholds).

CVD Z-Score (zcvdDelta): Measures the statistical significance of the bar-to-bar change in CVD (the difference between the current CVD close and open). This categorizes the buying/selling pressure into three tiers: HIGH (Bullish Pressure), MODERATE (Balanced/Noise), or LOW (Bearish Pressure) (using the 75th and 25th percentiles as thresholds).

The script uses the confluence of these three Volume tiers and three CVD tiers to assign one of the nine distinct cluster states to each bar.

🎯 The 9 Cluster Categories & Interpretation
The script plots a custom color on the volume histogram and a shape on the price chart (excluding the 'noise' clusters 6 and 9) corresponding to the assigned cluster. The colors and cluster numbers are referenced in the integrated reference table at the bottom-right of your chart.

Cluster ID Volume Level CVD Pressure Description Significance
1 HIGH HIGH Bullish Climax Extreme volume with overwhelming buying. Strong trend or potential exhaustion/climax.
2 HIGH LOW Bearish Climax Extreme volume with overwhelming selling. Strong trend or potential exhaustion/climax.
3 HIGH MODERATE Effort vs Result/Absorption High volume with balanced delta. Suggests strong resistance/support or absorption (large players taking the other side).
4 MODERATE HIGH Moderate Accumulation Standard volume supporting significant buying pressure. A healthy bullish push.
5 MODERATE LOW Moderate Distribution Standard volume supporting significant selling pressure. A healthy bearish push.
6 MODERATE MODERATE Normal Noise Average market activity. Volume and delta within normal ranges.
7 LOW HIGH Quiet Accumulation Low volume with strong buying pressure. Suggests hidden strength or demand (Smart money accumulation in thin markets).
8 LOW LOW Quiet Distribution Low volume with strong selling pressure. Suggests hidden weakness or supply (Smart money distribution in thin markets).
9 LOW MODERATE Quiet Noise Very low volume and balanced delta. Typical market rest, lack of interest, or range-bound consolidation.

Export to Sheets
⚙️ Customization
Z-Score Lookback Length: Controls the averaging period for the Z-Score calculation.

Cluster Lookback: Defines the size of the rolling window used for calculating the Volume and CVD Z-Score percentiles (default 40). Note: A lookback of less than 40 bars is statistically unreliable for stable percentile estimation.

CVD Input: The script uses a hardcoded request to an anchor timeframe (e.g., "1D") and a lower timeframe (e.g., "1") to calculate the CVD Delta. This provides a clear measure of intraday order flow pressure.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.