All indicators

Adaptive SuperTrend Oscillator

Oct 2, 2024

Static chart image
SignalsOscillatorsMachine LearningVolatility

The Adaptive SuperTrend Oscillator indicator utilizes volatility clustering and SuperTrend logic to identify market trends by dynamically adjusting to different volatility regimes. This tool helps traders visualize trend strength and direction through a smoothed, optionally normalized oscillator that adapts to changing market conditions using K-Means clustering.

Usage

The Usage section describes how the script can be used to identify market entries and trend shifts. Traders can monitor the oscillator's color changes and position relative to the zero line to gauge momentum.

  • Trend Identification: When the oscillator turns green and rises, it suggests a bullish trend. Conversely, a red and falling oscillator indicates bearish momentum.
  • Volatility Adaptation: The script automatically switches between high, medium, and low volatility settings, which is visible in the data table on the chart.
  • Heiken Ashi Mode: By enabling the Heiken Ashi candles, users can filter out market noise and focus on the core price momentum.
  • Reversal Signals: The indicator plots triangles when the oscillator crosses specific deviation bands, signaling potential overextended conditions or trend reversals.

Details

This script integrates the traditional SuperTrend calculation with advanced volatility clustering. By analyzing the Average True Range (ATR) over a training period, it applies a K-Means algorithm to group volatility into three distinct centroids (high, medium, and low).

The SuperTrend factor is applied to the centroid most relevant to the current market state, rather than a static ATR. This result is converted into an oscillator by calculating the distance between the price and the adaptive SuperTrend line. The script then applies smoothing (SMA or EMA) and optional normalization to keep the output within a consistent range for easier comparison across different assets.

Settings

SuperTrend Settings

  • ATR Length: Sets the lookback period for the initial ATR calculation used in volatility analysis.
  • SuperTrend Factor: The multiplier applied to the volatility clusters to determine the trend thresholds.

K-Means Settings

  • Training Data Length: The number of bars used to train the K-Means algorithm for volatility clustering.
  • Initial Volatility Percentile Guesses: Defines the starting points for the high, medium, and low volatility clusters based on percentiles.

Oscillator Settings

  • Normalize Oscillator: If enabled, scales the oscillator to a fixed range.
  • Smooth Oscillator: Enables smoothing to reduce signal noise.
  • Display as Heiken Ashi: Transforms the oscillator output into Heiken Ashi candlesticks.
  • Smoothing Method/Length: Allows users to choose between SMA and EMA and set the lookback period for smoothing.
  • Trend Lag: Determines the lookback used to compare the current oscillator value to a previous one to define the trend color.

FAQ

How do I use the volatility clusters?

The clusters are handled automatically by the algorithm. You can view the current cluster status in the table at the bottom right of the chart to understand if the market is currently in a high, medium, or low volatility state.

What is the purpose of normalization?

Normalization allows the oscillator to fluctuate within a predefined range regardless of the asset's price, making it easier to identify overbought or oversold extremes consistently across different symbols.

How can 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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

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