Support/Resistance v2 (ML) Kmean
Jul 16, 2024

The Support/Resistance v2 (ML) Kmean indicator utilizes machine learning clustering techniques to identify key supply and demand zones based on historical price distribution. By applying the K-means algorithm to multi-timeframe price data, the tool highlights significant levels where price action frequently clusters, providing a data-driven approach to support and resistance analysis.
Usage
The indicator can be used to identify high-probability reversal or breakout zones. The K-mean clusters appear as horizontal bands representing areas of high price density.
- Identifying Support/Resistance: Use the K-mean bands to find areas where the price is likely to stall or reverse.
- Volatility Channels: The script includes a Standard Deviation channel (plotted with an offset) that helps visualize the short-term expected range and volatility.
- Trend Confirmation: When price remains between specific K-mean clusters, it indicates a consolidation phase; a break from a cluster often signifies the start of a new trend leg.
Details
The script employs the K-means clustering algorithm, which partitions data into 'K' number of groups. It collects high and low price points from two user-defined timeframes (e.g., 1D and 12H) starting from a specific date.
- K-means Logic: It iteratively calculates centers of price clusters until the optimal mean values are found. This represents "fair value" levels where the market has historically spent the most time.
- Standard Deviation: The tool overlays a standard deviation calculation on the HLC3 price to assess current volatility relative to the identified ML levels.
Settings
Kmean settings
- Use seed: A specific integer to ensure the clustering results are consistent across refreshes. Set to 0 for random initialization.
- Use log mean: When enabled, the script uses logarithmic means to smooth the cluster data.
- maximum iteration: Defines the number of iterations the algorithm runs to find the most accurate cluster centers.
- K centers: Determines the number of support/resistance groups to generate (2-20).
- Iput first/additional timeframe: Sets the source timeframes used to collect high/low data points for the model.
- Start Date: The historical point from which the indicator begins collecting data for the ML model.
- Update K every N candles: Controls the frequency of the re-calculation to adapt to new price data.
STDEV settings
- STDEV offset: Shifts the standard deviation channel forward to project potential future price boundaries.
- STDEV Length: The lookback period for the standard deviation volatility calculation.
Colors
- Colors K: Customization options for the upper, middle, and bottom lines of the K-mean clusters, including fill transparency.
- Colors STDEV: Customization options for the volatility channel boundaries and fills.
FAQ
How do I interpret the K-mean bands?
Bands with more "entries" (visible in the dashboard table) represent levels where the price has historically clustered more frequently, suggesting stronger support or resistance.
Why do the levels move?
The levels are re-calculated every 'N' candles (defined in settings) to incorporate recent price action into the machine learning model.
How can I get access to Support/Resistance v2 (ML) Kmean?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.