All indicators

Machine Learning Supertrend

Jan 31, 2025

Static chart image
SignalsForecastingMachine LearningVolatility

The Machine Learning Supertrend indicator utilizes Gaussian Process Regression (GPR) and kernel-based learning to provide an adaptive trend-following system that forecasts volatility and price direction.

Usage

The Usage section describes how the script can be used to identify market trends and potential reversals. Unlike the standard Supertrend which uses a fixed Average True Range (ATR) multiplier, this tool employs a machine learning model to estimate price distributions and project future movements.

  • Trend Identification: When the price is above the adaptive level, the indicator plots a green line and fill, signifying a bullish trend. When the price is below the level, a red line and fill appear, signifying a bearish trend.
  • Reversal Detection: A trend change occurs when the price crosses the forecasted adaptive boundary. This shift is designed to be more responsive to changing market volatility than traditional methods.
  • Forecasting: Users can adjust the forecast period to project the trend boundary ahead of current price action, allowing for a proactive rather than purely reactive approach to trend following.

Details

The indicator is constructed using Gaussian Process Regression (GPR), a probabilistic machine learning technique. It utilizes a Radial Basis Function (RBF) kernel to model the underlying price structure.

The script execution involves:

  1. Kernel Matrix Construction: A kernel matrix is computed to establish the relationships between historical data points.
  2. Probabilistic Forecasting: Instead of simple moving averages, the tool uses the RBF kernel to project the expected price (Mean) into the future.
  3. Adaptive Volatility: The "Factor" is applied to a Mean Absolute Error (MAE) calculated from the machine learning prediction rather than a standard ATR. This creates boundaries that expand or contract based on the model's confidence and recent price deviations.

Settings

  • ATR Length: The lookback period used for the underlying statistical calculations and training data.
  • Factor: A multiplier that determines the distance of the bands from the predicted price. Higher values result in wider bands and fewer signals, while lower values increase sensitivity.
  • Forecast Period: The number of bars into the future the machine learning model projects its estimation.
  • Source: The price data input used for the calculations (e.g., Close, HL2).

FAQ

How do I interpret the colored zones? The green zone indicates a bullish market state where the model expects upward momentum to persist. The red zone indicates a bearish market state where downward momentum is expected.

How does this differ from the standard Supertrend? While the standard Supertrend uses historical volatility (ATR), this version uses a Gaussian Process Regression model to forecast volatility and price levels, making the bands more adaptive to non-linear market changes.

How can I access the Machine Learning Supertrend? 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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.