Anchored Clusters Volume Profile [LuxAlgo]The Anchored Clusters Volume Profile indicator utilizes K-Means clustering to categorize historical price action into distinct groups within a user-defined range 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 selected range defined by a starting and ending date. 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
Unlike traditional anchored volume profiles that provide a single histogram, this script employs a K-Means clustering algorithm to segment the range. This process involves:
Identifying the specific range of bars between the user-selected Start Time and End Time .
Initializing "centroids" across the price range of that period.
Iteratively assigning each price bar to the nearest centroid based on the HLC2 (median) price.
Recalculating centroids based on the volume-weighted average price of the assigned bars.
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
🔹 Anchor Settings
Start Time / End Time : Sets the beginning and end of the analysis range. These use the "Confirm" feature, allowing you to select the range directly on the chart after adding the indicator or changing settings.
Range Highlight : Adjusts the color and transparency of the background shading that identifies the analyzed range.
🔹 Clustering Settings
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.
Indicatore Pine Script®






















