Sugestão da Casa
OPEN-SOURCE SCRIPT

Volume Cluster Profile [VCP] (Zeiierman)

48 866
Overview
Volume Cluster Profile [VCP] (Zeiierman) is a volume profile tool that builds cluster-enhanced volume-by-price maps for both the current market window and prior swing segments.

Instead of treating the profile as a raw histogram only, VCP detects the dominant volume peaks (clusters) inside the profile, then uses a Gaussian spread model to “radiate” those peaks into surrounding price bins. This produces a smoother, more context-aware profile that highlights where volume is most meaningfully concentrated, not just where it happened to print.
snapshot
On top of the live profile, VCP automatically records historical swing profiles between pivots, wraps each segment for clarity, and can project the most recent segment’s High/Low Value extensions (VA/LV) forward to the current bar to keep key structure visible as price evolves.
snapshot
How It Works

1) Profile Construction (Volume-by-Price)
VCP builds a volume profile histogram over a chosen window (current lookback, or a swing segment):
  1. Range Scan
    The script finds the full min → max price range inside the window.
  2. Bin the Range
    That range is divided into a user-defined number of Price Bins (rows). More bins = finer detail, but heavier computation.
  3. Accumulate Volume into Bins
    For each bar inside the window, the script takes the bar’s close price, determines which price bin it belongs to, and adds the bar’s volume to that bin.

Pine Script®
float step = (maxPrice - minPrice) / binsCount for i = 0 to barsToUse - 1 int b = f_clamp(int(math.floor((close - minPrice) / step)), 0, binsCount - 1) volBins += volume

Result: volBins becomes a standard volume-by-price histogram (close-based binning).

2) Cluster Detection (Finding Dominant Peaks)
Once the raw histogram is built, VCP identifies cluster centers as the most meaningful volume “hills”:
  1. Local Peak Test
  2. A bin becomes a cluster candidate if its volume is greater than or equal to its immediate neighbors (left/right).
  3. Filter Weak Peaks
  4. Peaks must also be above a basic activity threshold (relative to the average bin volume) to avoid noise.
    Pine Script®
    bool isPeak = v >= left and v >= right if isPeak and v > avgVol array.push(clusterIdxs, b)
  5. Keep the Best Peaks Only
    If too many peaks exist, the script keeps only the strongest ones, capped by: Max Cluster Centers

Result: clusterIdxs = the set of dominant profile peaks (cluster centers).

3) Cluster Enhancement (Gaussian Spread Model)
This is what makes VCP different from a raw profile.

Instead of using volBins directly, the script builds an enhanced profile where each cluster center influences nearby price bins using a Gaussian curve:
  • Distance from each bin to each cluster center is computed in “bin units”
  • A Gaussian weight is applied so that bins near the center receive stronger influence, while bins farther away decay smoothly.
  • Cluster Spread (sigma) controls how wide this influence reaches: low sigma produces tight, sharp clusters, while high sigma results in wider, smoother structure zones.

Pine Script®
enhanced += centerV * math.exp(-(dist*dist) / (2.0 * clusterSigma * clusterSigma)) volBinsAI := enhanced / szClFinal

Result: volBinsAI = the cluster-enhanced volume value for each bin.

In practice, VCP turns the profile into a structure map of dominant volume concentrations, rather than a simple “where volume printed” histogram.

4) POC from the Enhanced Profile
After enhancement:
  • The bin with the highest volBinsAI becomes the POC (Point of Control)
  • POC is plotted at the midpoint price of that bin

Pine Script®
if volBinsAI > maxVol maxVol := volBinsAI, pocBin := b

So the POC reflects the cluster-enhanced profile rather than the raw histogram.

How to Use

Read Cluster Structure (Default = 2 Clusters)
By default, the Volume Cluster Profile (VCP) is configured to detect up to 2 dominant volume clusters within the profile. These clusters represent price zones where the market accepted trading activity, not just where volume printed randomly.

When TWO Clusters Appear
When VCP detects two distinct clusters, it usually indicates:
  • Two competing areas of value
  • Ongoing auction between higher and lower acceptance zones

snapshot
  • Treat each cluster as an acceptance zone
  • Expect slower price action and rotation inside clusters
  • Expect faster movement in the low-volume space between clusters

Use cluster-to-cluster movement as:
  • rotation targets
  • range boundaries
  • acceptance vs rejection tests

Typical behavior:
  • Price enters a cluster → stalls, consolidates, rotates
  • Price rejects at cluster edge → moves toward the opposite cluster

snapshot
When ONLY ONE Cluster Appears
If VCP detects only one cluster, or if two clusters visually merge into one:
  • Volume is no longer split
  • The market has formed a single dominant value area
  • Price consensus is strong

snapshot
  • Treat the cluster as the primary value anchor
  • Expect pullbacks and reactions around this zone

Bias becomes directional:
  • Above the cluster → bullish context
  • Below the cluster → bearish context
  • Inside the cluster → balance/chop

This structure often appears during clean trends or stable equilibria.
snapshot
VA/LV Extensions

VCP projects two zones from the end of the most recent swing segment:
  • VA extension = the segment’s highest enhanced-volume bin (dominant zone)
  • LV extension = the segment’s lowest enhanced-volume bin (thin/weak zone)

A breakout of the VA extension signals acceptance and potential continuation. A retest of the VA or LV extension is used to confirm acceptance or rejection, while rejection from either zone often leads to rotation back toward value.
snapshot

Settings
Cluster Volume Profile
  • Lookback Bars – how many recent bars build the current profile
  • Price Bins – profile resolution (more bins = more detail, heavier CPU)
  • Cluster Spread – Gaussian sigma; higher values widen/smooth cluster influence
  • Max Cluster Centers – cap on detected peaks used in enhancement

Historical Swing Cluster Volume Profile
  • Pivot Length – swing sensitivity (larger = fewer, broader segments)
  • Max Profiles – how many historical segments to retain
  • Profile Width – thickness of each historical profile

High & Low Value Area
  • Profile VA/LV – extend the last segment’s top-bin and low-bin zones forward


-----------------
Disclaimer

The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.

All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.