Colored Moving Averages Can Help You Spot Trends
Jan 3, 2020

The Color MA indicator provides a visually intuitive trend-following tool by dynamically changing the color of a selected moving average based on its slope. It aims to simplify trend identification by highlighting bullish phases in green and bearish phases in red, allowing traders to quickly assess market momentum.
Usage
The Usage section describes how the script can be used to interpret market direction. When the moving average is rising, it indicates bullish momentum; conversely, a falling moving average suggests bearish momentum. Traders can use these color transitions as potential signals for trend reversals or as filters to ensure they are trading in the direction of the primary trend.
For example, a trader might use a 20-period Simple Moving Average (SMA) on a daily chart. If the line turns green, it suggests a short-term upward trend, while a turn to red indicates a downward shift. The script also includes built-in alerts that trigger specifically when these direction changes occur, facilitating timely decision-making.
Details
The script calculates the selected moving average and compares the current value to the previous bar's value. If the current value is greater, the slope is positive; if it is lower, the slope is negative.
The indicator includes five distinct moving average calculation methods:
- Simple Moving Average (SMA): Calculates the average price over a specific number of periods.
- Exponential Moving Average (EMA): Places a higher weight on recent data points to reduce lag.
- Hull Moving Average (HMA): Designed to reduce lag while maintaining smoothness.
- Weighted Moving Average (WMA): Assigns a heavier weighting to more recent price data linearly.
- Volume Weighted Moving Average (VWMA): Weights the moving average based on trading volume, emphasizing periods with higher activity.
Settings
- Length: Determines the number of bars used in the moving average calculation.
- Source: Defines the price data used for the calculation (e.g., Close, Open, High, Low).
- AvgType: Selects the specific mathematical model for the moving average:
- 1 = Simple Moving Average (SMA)
- 2 = Exponential Moving Average (EMA)
- 3 = Hull Moving Average (HMA)
- 4 = Weighted Moving Average (WMA)
- 5 = Volume Weighted Moving Average (VWMA)
FAQ
How do I interpret the color changes on the Color MA?
The color changes represent the slope of the moving average. Green signifies an increasing value (upward trend), and red signifies a decreasing value (downward trend).
Can I set alerts for trend changes?
Yes, the script includes automated alert conditions that trigger whenever the moving average shifts from falling to rising or vice versa.
How do I access the Color MA 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.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.