Trend Following Moving Averages
Mar 18, 2020

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

