ML Liquidity Zone Classifier
Jun 2, 2026

The ML Liquidity Zone Classifier indicator utilizes a rolling k-Nearest Neighbors (k-NN) machine-learning model to identify and filter high-probability liquidity zones by evaluating volume, higher-timeframe alignment, and displacement strength.
Usage
The Usage section describes how the script can be used to identify significant market interest areas while filtering out lower-probability noise.
- Liquidity Identification: The script automatically detects Bullish/Bearish Order Blocks, Equal Highs (EQH), Equal Lows (EQL), and High-Volume Nodes.
- Confidence Filtering: Every potential zone is assigned a confidence score (0-100%). Users can set a minimum threshold (e.g., 65%) so that only zones with strong machine-learning backing are rendered on the chart.
- Contextual Awareness: The tool uses an "Auto HTF" feature to align local liquidity with higher-timeframe trends, helping traders identify where institutional interest may reside on a broader scale.
- Chart Management: The script manages visual clutter by deduplicating overlapping zones, enforcing a cooldown period between new zones, and optionally removing (mitigating) zones once price has closed through them.
Details
The script operates through a multi-stage machine-learning pipeline:
- Feature Extraction: Each potential setup is converted into a three-factor vector:
- Relative Volume: Volume compared to its moving average.
- HTF Proximity: Distance to the nearest higher-timeframe OHLC level.
- Displacement Strength: Candle body size relative to the Average True Range (ATR).
- Delayed Labeling: To avoid repainting, the script uses a delayed evaluation window. It waits a specific number of bars to see if price moved significantly (based on ATR) from a prior setup. If the move was successful, that historical sample is labeled as "high probability" in the training set.
- k-NN Classification: When a new liquidity event is detected, the classifier measures the Euclidean distance between the current features and the stored training samples. The "votes" of the nearest neighbors determine the final confidence percentage.
- Zone Lifecycle: Active zones are extended to the right. The script maintains a "Zone Quality Gate" to ensure zones are not too tall (clamped via ATR) and are not clustered too closely together.
Settings
KNN Classifier
- K (neighbors): Controls the number of historical samples used to calculate confidence.
- Training window: Sets the maximum number of labeled samples stored in the rolling training set.
HTF Alignment
- Auto HTF: Automatically determines a higher timeframe based on the current chart.
- Auto HTF multiplier: The factor used to calculate the target higher timeframe.
- Manual HTF: The timeframe used if "Auto HTF" is disabled.
Zone Detection
- Volume spike multiplier: The minimum volume expansion required to identify a high-volume node.
- Order block ATR mult: The required candle body size relative to ATR to qualify as displacement.
- Equal H/L tolerance: The ATR-based sensitivity for detecting horizontal pivot levels.
Zone Quality
- Min confidence to draw a zone: The required classifier score (0-100) for a zone to appear.
- Min bars between zones: The minimum interval (cooldown) required between rendering new zones.
- Merge distance (ATR): The distance used to prevent overlapping or redundant zones.
- Max zone height (ATR): Limits the vertical size of zones to prevent oversized boxes.
- Remove zones when price breaks them: Enables mitigation logic to delete zones after they are breached.
FAQ
How does the confidence score work? The score represents how closely the current market conditions (volume, HTF, and displacement) resemble past setups that resulted in a significant price move. A higher score indicates a stronger historical correlation with successful outcomes.
Why are there no zones appearing on my chart? The script requires time to build its training set. Additionally, if your "Min confidence" setting is too high, the script will filter out all but the most ideal setups.
How do I get access to the ML Liquidity Zone Classifier? 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.