Machine Learning | Adaptive Trend Signals

Apr 25, 2025

Static chart image
Signals
Machine Learning
Dashboard
Moving Averages
Volatility

The Machine Learning | Adaptive Trend Signals indicator is a comprehensive trend-following tool that utilizes K-Means clustering and Gaussian smoothing to adapt to shifting market volatility. By categorizing volatility into distinct states, it dynamically adjusts its sensitivity to provide clearer trend identification and actionable signals.

Usage

The Usage section describes how the script can be used to navigate different market environments. The indicator functions primarily as an overlay, providing a multi-layered approach to trend analysis:

  • Trend Identification: Users can monitor the SmartTrend3 line (the average of two internal trend calculations) to determine the current market bias. The line changes color and transparency based on the detected trend direction and the current volatility cluster.
  • Signal Interpretation: Bullish (🐮) and Bearish (🐻) markers appear when specific crossover conditions are met between the adaptive trend lines, filtered by RSI and ADX requirements. These serve as potential entry or exit points.
  • Volatility Adaptation: The script automatically shifts its sensitivity based on K-Means clustering. During high volatility, the trend factor tightens to capture rapid moves, while in low volatility, it widens to avoid noise.
  • Backtest Evaluation: A dashboard in the top-right corner displays the historical performance (Win Rate and Total Trades) of the underlying logic, allowing users to assess how the settings perform on a specific asset.

Details

The script integrates several advanced technical concepts to maintain accuracy across different timeframes:

  • K-Means Volatility Clustering: The algorithm gathers ATR data over a 100-bar training period and iteratively groups it into three clusters: High, Medium, and Low volatility. This determines the "SmartTrend Factor" used in the primary calculations.
  • Gaussian Smoothing: To remove market "jitter," a Gaussian kernel is applied to both the RSI and the final trend lines. This results in smoother transitions compared to standard moving averages.
  • SmartTrend Logic: The core calculation uses a volatility-adjusted standard deviation. It requires alignment between price, RSI (>50 for bullish, <50 for bearish), and ADX (rising and >15) to confirm that a trend has sufficient momentum to be considered valid.
  • Backtesting Methodology: The internal backtester uses the SmartTrend3 value for trade execution logic. It simulates a single-position system where opposite signals close existing positions.

Settings

Adaptive ML SmartTrend Settings

  • ATR Length: Sets the period for the Average True Range calculation used in the K-Means volatility clustering.
  • Period: The lookback period used for RSI, ADX, and standard deviation calculations.
  • Base SmartTrend Factor: The base multiplier for the volatility-adjusted bands; higher values create wider, more conservative trend lines.
  • SmartTrend Smoothing Length: Determines the lookback for the Gaussian kernel smoothing applied to the trend lines.

Appearance

  • Show Buy/Sell Signals?: Toggles the visibility of the bullish (🐮) and bearish (🐻) signal markers.
  • Bullish/Bearish Color: Customizes the colors used for trend lines and signal shapes.
  • Show Backtest Table: Enables or disables the performance dashboard on the chart.
  • Table Size: Adjusts the visual size of the backtest information table.

FAQ

How do I interpret the different colors on the trend line? The color indicates the trend direction (Bullish or Bearish), while the gradient/transparency reflects the current volatility cluster assigned by the machine learning algorithm.

Why do signals sometimes disappear or change on the current bar? Signals are confirmed upon bar close. Because the indicator uses adaptive smoothing and volatility clustering, the "real-time" bar may fluctuate until the data is finalized.

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 access on the following platforms
tradingviewSymbolTradingView
ninjatraderNinjaTrader
metatrader4MetaTrader 4/5
thinkorswimThinkorswim

Unlock Unlimited Access to the LuxAlgo Library

Upgrade your plan to get all indicators, strategies, charts, and full access to Quant, our AI agent.

Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.

Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.

As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.

Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.

Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.

This does not represent our full Disclaimer. Please read our full disclaimer.

© 2026 LuxAlgo Global, LLC.