Machine Learning Supertrend
Apr 6, 2026

The Machine Learning Supertrend tool is an advanced trend-following system that utilizes an adaptive engine to continuously self-optimize its parameters based on real-time market performance. By combining a core SuperTrend foundation with momentum filtering and volume confirmation, it provides dynamic entry signals designed to adapt to changing market regimes.
Usage
The Usage section describes how the script can be used to identify trend exhaustion or breakout opportunities while managing signal quality through various filters.
Signal Modes
Users can choose between two primary operational modes:
- Reversal: Designed to capture turning points when a trend exhausts and the SuperTrend flips direction.
- Breakout: Fires when price pushes into new extremes within the current trend, focusing on momentum.
Performance Tuning
The indicator’s output is heavily influenced by three core settings:
- Band Width: This is the most impactful setting. Lower values create tight bands for frequent, sensitive signals, while higher values (2.0–3.0) produce fewer signals focused on major structural moves.
- Lookback Window: Determines the number of bars scanned for highs and lows. Shorter windows react to minor swings, while longer windows (50+) react only to large pivots.
- Signal Spacing: Sets a minimum bar count between signals to prevent clustering in choppy market conditions.
Filtering and Confirmation
To improve signal reliability, several confirmation layers can be enabled:
- Momentum Filter: Uses RSI to ensure signals only fire when the market is coming from overbought or oversold conditions.
- Flow Analysis: Requires a volume surge (relative to a sample depth) for a signal to fire, ensuring the move has market participation.
- Key Levels: Restricts signals to major structural turning points where the price range exceeds a specific ATR multiple.
Details
The script operates using a background simulation framework that runs in parallel with the visible signal engine.
Adaptive Engine
The indicator features an auto-tune engine that runs a 5x5 test matrix of simulated trades. It calculates win rates, profit factors, and Sortino ratios to propose parameter adjustments. These adjustments are applied through a Global Optimizer for long-term stability and a Micro-Batch Processor for faster, short-term reactions.
Market Context (Regime Grid)
A 2D memory map, known as the Regime Grid, tracks which settings perform best under specific conditions of trend strength and volatility. When the market enters a known state, the indicator biases its parameters toward the historically successful settings for that specific regime.
Risk Guard and Decay Traces
The script includes built-in logic to pause signals after a series of losses or after reaching a session loss limit. Furthermore, "Decay Traces" monitor for large adverse moves to proactively tighten stops based on recent trade outcomes.
Settings
Signal Mode
- Signal Type: Selects between Reversal or Breakout logic.
- Require Fresh Pivot: Requires a new high/low before a signal can fire.
- Signal Spacing: Minimum bars between entries.
Volatility Envelope
- Lookback Window: Sensitivity for high/low detection.
- Smoothing Period: ATR calculation period for bands.
- Band Width: ATR multiplier for band distance.
- Price Basis: Source price for calculations (e.g., hlcc4, close).
- True Range Mode: Toggles between RMA and EMA smoothing for volatility.
Momentum & Flow
- Active (RSI): Toggles the RSI momentum filter.
- Length: RSI period.
- Sample Depth (Volume): Bars used to determine average volume.
- Surge Threshold: Multiplier required for volume confirmation.
Auto-Tune & Optimizer
- Reactivity: A master dial controlling the speed and aggressiveness of adaptation.
- Enable Auto-Tune: Master switch for the self-adjusting engine.
- Step Size: The learning rate for parameter updates.
- History Depth: The rolling window of trades used for optimization statistics.
- Regime Grid: Enables/disables the context-aware memory system.
FAQ
How do I reduce noise in choppy markets? Increase the Band Width, enable "Require Surge" for volume confirmation, or turn on "Key Levels Only" to focus on major structural shifts.
What does the "Reactivity" setting do? It acts as a master dial for the machine learning components. Higher values make the indicator adapt quickly to new price action, while lower values keep the settings more stable and closer to your manual inputs.
How do I access this indicator? 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.