Moving Averages (2, 10, 20, 50, 55, and 200)
Aug 12, 2019

The Moving Averages (2, 10, 20, 50, 55, and 200) indicator plots six distinct Simple Moving Averages (SMA) simultaneously to help traders identify trend direction, potential support and resistance zones, and momentum shifts across multiple timeframes.
Usage
The Moving Averages tool is designed to consolidate multiple trend-following lines into a single indicator slot, providing a cleaner chart interface. Traders use these specific lengths to categorize market behavior:
- Short-Term Momentum: The 2, 10, and 20-period averages track immediate price fluctuations and short-term trends.
- Medium-Term Trends: The 50 and 55-period averages are commonly used to identify intermediate trend health and "golden cross" or "death cross" setups.
- Long-Term Sentiment: The 200-period average serves as a primary filter for the long-term trend; price trading above this level is generally considered bullish, while price below is considered bearish.
Users can toggle individual averages on or off within the settings menu to focus on specific market cycles. For example, a scalper might only enable the 2 and 10 periods, while a position trader might focus on the 50 and 200.
Details
The indicator utilizes the Simple Moving Average (SMA) calculation for all six lines. The SMA calculates the average of a selected price source (typically the close) over a specific number of preceding bars.
The script includes built-in alert conditions for the 200-period moving average. Alerts are triggered when the price crosses above or below this specific threshold on a bar-close basis, aiding in the identification of major trend shifts. This implementation is based on original concepts by @BitcoinCensus and has been refactored for Pine Script v6 to ensure performance efficiency and visual clarity.
Settings
- Length 1-6: Sets the number of bars used for the calculation of each respective moving average.
- Source 1-6: Determines which price data (Close, Open, High, Low, HL2, etc.) is used as the input for each calculation.
FAQ
Which moving average lengths are included by default?
The indicator defaults to the 2, 10, 20, 50, 55, and 200 Simple Moving Averages, though these can be customized in the settings.
Can I set alerts for the other moving averages?
While the script features dedicated alerts for the 200-period MA crossing, users can manually create alerts for the other plots using the platform's standard alert interface.
How do I access the Moving Averages (2, 10, 20, 50, 55, and 200) indicator?
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.