All indicators

Trend Following Moving Averages

Mar 18, 2020

Static chart image
SignalsChannelsMoving Averages

The Trend Following Moving Averages indicator identifies and visualizes trend strength across multiple timeframes by analyzing moving average momentum relative to dynamic price channels.

Usage

The Usage section describes how the script can be used to identify market regimes and momentum shifts. The indicator plots 20 different moving average lengths (from 5 to 100) on the chart, with colors that dynamically change based on trend intensity.

  • Trend Identification: When the moving average (MA) lines are colored, it indicates a trending environment. Gray or invisible lines suggest a ranging or neutral market.
  • Strength Visualization: The color intensity (transparency) of the MA lines reflects the strength of the trend. A solid, vibrant color indicates a strong move, while a faded color suggests weakening momentum.
  • Multi-MA Alignment: Traders can look for "full alignment" where all 20 MA lines share the same color, signifying a powerful trend across all measured lookback periods.
  • Noise Reduction: By enabling Linear Regression, users can smooth out minor price fluctuations, though this may introduce a slight lag of 1–2 bars.

Details

The script operates by creating a channel based on the highest and lowest points of a specific moving average over a set period. It compares the width of this MA-based channel to the overall price range of the last 300 bars.

A trend is confirmed if the width of the MA channel exceeds a specific percentage of the total price range. The script then calculates the ratio between the channel and the MA to determine trend strength. This calculation is applied to 20 different MA lengths simultaneously, providing a comprehensive view of trend health. The logic ensures that the indicator remains adaptive across various assets and timeframes by normalizing the trend detection against historical volatility.

Settings

  • MA Type: Selects the calculation method for the moving averages (EMA, SMA, RMA, WMA, or VWMA).
  • Period to Check Trend: Determines the lookback period for creating the MA-based channel; higher values increase sensitivity.
  • Trend Channel Rate %: Sets the threshold for trend detection relative to the 300-bar price range.
  • Use Linear Regression: When enabled, applies a linear regression filter to the moving averages to reduce market noise.
  • Linear Regression Period: Defines the lookback period used for the linear regression smoothing.

FAQ

How do I interpret the different colors on the chart? Green lines indicate a bullish trend, while red lines indicate a bearish trend. The darker and more solid the color, the stronger the momentum for that specific moving average length.

What is the benefit of using multiple moving averages? Using 20 different lengths allows you to see if a trend is supported across short-term, medium-term, and long-term periods simultaneously, reducing the likelihood of being misled by a single timeframe.

How can I access this tool? 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.