OPEN-SOURCE SCRIPT

Clusters Volume Profile [LuxAlgo]

4 060
The Clusters Volume Profile [LuxAlgo] indicator utilizes K-Means clustering to categorize historical price action into distinct groups and generates individual volume profiles for each detected cluster. This tool provides a unique perspective on volume distribution by isolating price behaviors based on proximity rather than strictly chronological order.

🔶 USAGE

The indicator identifies "clusters" of price activity within a user-defined lookback period. Each cluster is assigned a unique color and its own horizontal volume profile, allowing traders to see where liquidity is most concentrated within specific price regimes.

🔹 Identifying Institutional Zones

Traders can use the Point of Control (POC) of high-volume clusters to identify significant institutional interest. Because the K-Means algorithm groups price action by density rather than time, a cluster's POC often represents a "fair value" level where significant exchange occurred. These dashed POC lines frequently act as robust support or resistance levels when price returns to them in the future.

🔹 Market Regime Detection

By observing the vertical distribution and overlap of clusters, traders can identify market phases. Overlapping clusters with high volume often indicate accumulation or distribution phases (sideways markets), whereas distinct, vertically separated clusters with lower volume gaps between them suggest a trending environment. A shift from multiple overlapping clusters to a new, isolated cluster can signal a breakout or the start of a new trend.

🔹 Precision Entry & Exits

Cluster boundaries and POC lines provide concrete levels for trade management. An entry can be sought when price retests a high-volume cluster POC, while stops can be placed outside the total price range of that specific cluster (the area covered by its volume profile). Conversely, targets can be set at the POC of the next major cluster above or below current price action.

🔹 Volume Conviction

The tool provides specific volume metrics that allow traders to gauge conviction. By comparing the "Total" volume label of one cluster against another, a trader can determine which price regime had more participation. A breakout into a price zone with a high-volume cluster suggests stronger conviction and a higher probability of the level holding compared to a zone with low total volume.

🔶 DETAILS

The script employs a K-Means clustering algorithm. This process involves:

  1. Initializing "centroids" across the price range of the lookback period.
  2. Iteratively assigning each price bar to the nearest centroid based on the HLC2 (median) price.
  3. Recalculating centroids based on the volume-weighted average price of the assigned bars.
  4. Finalizing assignments after the specified number of iterations to ensure stable clusters.


By separating price action into these clusters, the tool helps identify high-interest zones that might be obscured by a single, traditional Volume Profile.

🔶 SETTINGS

🔹 Clustering Settings

  • Lookback Period: Determines the number of recent bars used for the clustering analysis.
  • Number of Clusters: Sets how many distinct price groups the algorithm should attempt to find (2 to 10).
  • K-Means Iterations: Controls the number of times the algorithm refines the cluster centers. Higher values can lead to more stable results.


🔹 Volume Profile Settings

  • Rows per Cluster VP: Defines the vertical resolution (number of bins) for each individual cluster's profile.
  • Max VP Width (Bars): Sets the maximum horizontal length of the volume profile histograms.
  • VP Offset: Adjusts the horizontal spacing between the current bar and the start of the volume profiles.
  • Highlight Price Dots: Toggles the visibility of the colored dots on the price action to identify cluster assignments.
  • Dot Size: Adjusts the size of the cluster assignment dots on the chart, ranging from tiny to huge.

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.