KDE Value Clouds [LuxAlgo]The KDE Value Clouds indicator is a quantitative tool that uses Kernel Density Estimation (KDE) to visualize the statistical distribution of price action, identifying high-density "Value Clouds" where the market has spent the most time.
🔶 USAGE
The indicator highlights areas of price " fair value " by calculating the probability density of price across a user-defined lookback period. Traders can use these density clusters to identify significant support and resistance levels that are often invisible to standard trend-following indicators.
🔹 Value Clouds
The " Value Clouds " appear directly on the price chart as gradient boxes. These clouds highlight regions where the density of price action exceeds the 50th percentile of the total distribution.
High Density (Bright Colors): Indicates a "Balance Area" where the market has reached a temporary equilibrium. These often act as magnets for price.
Low Density (Gaps): Indicates "Inefficiency" or fast moves where the market did not spend much time. These areas are often revisited or "filled" later.
🔹 KDE Profile & POC
On the right side of the chart, a smooth horizontal profile represents the continuous density function. The KDE POC (Point of Control) is the single price level with the highest calculated density within the lookback period, serving as the ultimate "anchor" for the current market regime.
🔹 How to use
Traders can look for price to "stall" or range within the bright Value Clouds, as these represent accepted price levels. When price moves into a "Gap" (a low-density area), it often moves quickly until it reaches the next cloud.
The KDE POC can be used as a primary support or resistance level; a breakout above a high-density cloud often signals a shift in market sentiment, while a rejection at the edge of a cloud suggests the market is still in a balanced state.
🔶 DETAILS
🔹 KDE vs. Volume Profile
A standard Volume Profile relies on "bins" (rectangles) to count volume at specific price steps. This can create "jagged" profiles that change drastically depending on the chosen row size.
The KDE Value Clouds approach is different because it uses a continuous probability function. Every price point in the lookback period contributes a small "bell curve" of influence to the total profile. This allows for a much smoother and more mathematically sound representation of where " Value " actually resides, regardless of arbitrary bin sizes.
The core of this indicator relies on two primary mathematical concepts:
Gaussian Kernel Estimation: Instead of simply counting occurrences, the script applies a Gaussian weight to every price point. This results in a "smooth" profile that captures the true shape of the price distribution.
Silverman’s Rule of Thumb: To prevent the clouds from being too noisy or too blurry, the indicator uses Silverman’s rule to calculate an optimal " Bandwidth ." This bandwidth adapts based on the standard deviation of the price data, ensuring the visualization stays relevant across different volatility regimes.
🔶 SETTINGS
🔹 Main Settings
Lookback Period: The number of bars used to calculate the price density. A higher lookback provides a "macro" view of value, while a lower lookback focuses on recent rotations.
Bandwidth Multiplier: Adjusts the "smoothness" of the KDE curve. Increasing this value will make the clouds broader and smoother; decreasing it will make them more granular.
Precision (Steps): Defines the vertical resolution of the density calculation. Higher values result in a more detailed profile.
🔹 Visualization
High/Low Density Colors: Customizes the gradient used for both the side profile and the on-chart clouds.
Profile Width (%): Controls how far the KDE profile extends horizontally across the right side of the chart.
Show Value Cloud on Chart: Toggles the visibility of the background "clouds" that highlight high-density price zones.
Pine Script®指标






















