Moving Averages
Nov 4, 2024

The Moving Averages indicator provides a multi-functional trend analysis environment by consolidating up to five customizable moving average lines into a single tool to streamline chart management and trend identification.
Usage
The Usage section describes how the script can be used, examples should be provided in this section. This section also focuses on how main settings affect the indicator interpretation and output.
- Multi-Trend Analysis: Users can enable up to five different moving averages to identify short-term momentum and long-term trend directions simultaneously. For example, a trader might enable a 10-period SMA for immediate trend direction and a 200-period SMA for institutional support/resistance levels.
- Visual Direction Cues: By enabling the "Smart Opacity" feature, the script provides immediate visual feedback on trend strength. When a moving average is ascending, it remains opaque; when it begins to descend, it becomes more transparent, allowing traders to spot potential trend exhaustion or reversals without looking at specific price values.
- Multi-Timeframe Integration: The tool allows users to plot moving averages from higher timeframes (e.g., a Daily EMA on a 1-hour chart) to maintain a macro perspective while trading on lower intervals.
Details
The script is built to offer flexibility by including seven different calculation methods: Simple Moving Average (SMA), Exponential Moving Average (EMA), Weighted Moving Average (WMA), Volume Weighted Moving Average (VWMA), Hull Moving Average (HMA), Smoothed Moving Average (SMMA), and Triangular Moving Average (TMA).
The "Smart Opacity" logic functions by comparing the current value of the moving average ($MA_t$) to its previous value ($MA_{t-1}$). If $MA_t < MA_{t-1}$, the script applies an additional transparency offset to the line color. Furthermore, the script includes built-in alert conditions for price crossovers and crossunders for each of the five enabled lines.
Settings
- Moving Average Type: Selects the mathematical calculation method (SMA, EMA, WMA, VWMA, HMA, SMMA, TMA) applied to all active lines.
- Timeframe: Sets the timeframe from which the moving average data is pulled.
- MA 1-5 Toggle: Enables or disables the visibility of the specific moving average line.
- Length: Sets the lookback period for the specific moving average calculation.
- Color/Style/Width: Customizes the visual appearance (Solid, Dashed, or Dotted) and thickness of the line.
- Smart Opacity: Enables dynamic transparency based on whether the moving average is currently ascending or descending.
- Transparency Offset: Determines the amount of transparency added to the line when it is in a descending state.
FAQ
How do I enable more than one moving average? You can enable up to five different lines by checking the boolean boxes next to each MA entry in the settings menu. Each can be assigned a unique length and color.
What does the Smart Opacity feature do? Smart Opacity automatically dims the moving average line when it starts to slope downwards. This provides a visual cue for bearish momentum or trend cooling.
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.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.