Trend Gradient Moving Average
Sep 6, 2021

The Trend Gradient Moving Average indicator provides a visual representation of trend strength by applying a dynamic color gradient to various moving average types based on the persistence of price direction. This tool helps traders identify the maturity and intensity of a trend through intuitive color transitions, allowing for more nuanced trend analysis compared to traditional single-color moving averages.
Usage
The Usage section describes how the script can be used to interpret market momentum and trend shifts. The indicator functions by tracking the number of consecutive advances or declines in the moving average value relative to its smoothed baseline.
- Trend Identification: When the moving average color shifts toward the "Bull Color," it indicates a developing uptrend. A deeper, more intense color signifies a sustained move with higher momentum. Conversely, a shift toward the "Bear Color" indicates a strengthening downtrend.
- Reversal Detection: The "Neutral Color" acts as a transition zone. When the gradient returns to this color, it suggests the current trend is losing momentum or potentially entering a consolidation phase.
- Customization: Users can select from various moving average types (SMA, EMA, RMA, WMA, HMA, VWMA, TMA) to suit different trading styles, such as using an HMA for reduced lag or a VWMA for volume-weighted analysis.
Details
The script utilizes a specialized advance/decline gradient function. It compares the selected moving average against a short-term EMA (the center line) to determine the direction of the trend.
- Gradient Logic: If the moving average is above the center line and continues to rise, a counter increments, increasing the intensity of the bullish color. If it begins to fall while still above the center line, the counter decrements, fading the color back toward the neutral tone.
- Step Calculation: The "Max Gradient Steps" setting determines the sensitivity of the color change. If the steps are set to a low value, the gradient reaches maximum intensity quickly; a higher value requires a more prolonged move to reach full color saturation.
Settings
- Bull Color: Sets the target color for strong bullish trends.
- Bear Color: Sets the target color for strong bearish trends.
- Neutral Color: Sets the color used for transitions and weak momentum.
- MA: Toggles the visibility of the moving average line.
- MA Type: Selects the calculation method for the moving average (SMA, EMA, RMA, WMA, HMA, VWMA, or TMA).
- Source: Determines the price data used for the calculation (e.g., Close, Open, High, Low).
- MA Length: Sets the lookback period for the primary moving average calculation.
- Max Gradient Steps: Controls the speed of the color transition; fewer steps result in faster color changes, while more steps require a longer trend to reach maximum intensity.
FAQ
What moving average type is best for this indicator? There is no single "best" type, as it depends on your strategy. An EMA or HMA will react faster to price changes, while an SMA or TMA will provide a smoother, slower-reacting gradient.
How do I interpret the neutral color? The neutral color appearing after a strong trend signifies a "cooling off" period where the moving average is moving against the primary trend direction or flattening out.
How can I access the Trend Gradient Moving Average? 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.