Machine Learning Support and Resistance
Aug 23, 2024

The Machine Learning Support and Resistance indicator uses unsupervised learning techniques to identify significant price zones where the market might reverse or stall. By employing a K-means clustering algorithm, the tool dynamically categorizes historical price data into three primary levels, providing a data-driven approach to market structure analysis.
Usage
The indicator can be used to identify high-probability reversal points and trend continuation zones. It offers two distinct ways to view the market structure:
- Trailing Levels: These are real-time, fluid zones that adjust as new price data enters the clustering window. They are useful for spotting immediate shifts in momentum and identifying the current "center of gravity" for price.
- Fixed Levels: When a cluster centroid stabilizes for a set period, the indicator plots a horizontal "fixed" level. These represent stronger historical areas of interest.
- Market Analysis: Traders often look for price reactions at these clusters to confirm entries, set stop losses, or determine take-profit targets.
Details
This tool implements a K-means clustering algorithm to process historical price data within a user-defined lookback window. The process involves:
- Initialization: Three centroids are initially placed at the highest price, lowest price, and the midpoint of the lookback period.
- Iterative Optimization: The algorithm iterates through price data, assigning each price point to the nearest centroid and then recalculating the centroid's position based on the average of its assigned points.
- Stabilization: The process continues until the centroids stabilize, effectively finding the three most significant price "clusters."
- Confirmation: If a centroid remains at the same price level for the duration of the "Confirmation Length," it is promoted to a "Fixed Level," indicating a more permanent area of support or resistance.
Settings
Main Settings
- Remove Levels After x Bars: Determines the lifespan of fixed levels before they are automatically removed to prevent chart clutter.
- Clustering Training Length: The lookback window used by the machine learning algorithm to gather price data for clustering.
- Confirmation Length for Fixed Levels: The number of bars a trailing level must remain stationary before a fixed horizontal line is drawn.
Appearance
- Show Trailing Levels: Toggles the visibility of the dynamic, real-time clustering zones and fills.
- Show Fixed Levels: Toggles the visibility of the permanent horizontal support and resistance lines.
- Color Fixed Levels: When enabled, horizontal lines are dynamically colored based on whether the current price is above (bullish) or below (bearish) the level.
- Bullish/Bearish Color: Customizes the visual output for the identified support and resistance zones.
FAQ
How do I use the Machine Learning Support and Resistance indicator?
You can use it to identify significant price zones where the market is likely to react. It is best used in conjunction with trend indicators to find optimal entry points at pullbacks to support or resistance.
What is the difference between trailing and fixed levels?
Trailing levels move in real-time as new data is processed by the clustering algorithm, while fixed levels only appear once a specific price area has been confirmed as a significant cluster over a period of time.
How can I access this tool?
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.