Moving Average Cross Alert
Nov 17, 2019

The Moving Average Cross Alert indicator identifies trend reversals and entry signals by detecting crossovers between two customizable moving averages with integrated multi-timeframe functionality.
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.
The indicator is primarily used to identify momentum shifts through the intersection of a short-period and long-period moving average. When the short-period average crosses above the long-period average, a bullish trend is signaled, highlighted by a green background and a "Buy" arrow. Conversely, a cross below signals a bearish trend with a red background and a "Sell" arrow.
Users can apply this tool for trend following or mean reversion strategies. For example, a trader might use the Multi-Timeframe (MTF) feature to plot Weekly moving averages on a Daily chart to ensure they are trading in the direction of the higher-timeframe trend. The moving average lines themselves change color based on their slope: green for ascending, red for descending, and blue for flat periods, providing immediate feedback on momentum strength.
Details
This script is an evolution of the original concept by ChartArt, refactored for modern performance and multi-timeframe compatibility. It allows for the selection of four distinct calculation methods:
- SMA (Simple Moving Average): Provides a basic average of price over the selected period.
- EMA (Exponential Moving Average): Places more weight on recent price action to reduce lag.
- WMA (Weighted Moving Average): Assigns a linear weighting to price points.
- Linear (Linear Regression): Uses a least-squares fit to project price trends.
The indicator utilizes request.security to fetch data from different resolutions, allowing users to stabilize signals by filtering out lower-timeframe noise. The background highlights and plot shapes are triggered specifically when a crossover occurs and is confirmed by price action.
Settings
- Price Source For The Moving Averages: Determines which price data (Close, HL2, HLC3, OHLC4) is used for the calculations.
- Use Current Timeframe As Resolution?: When enabled, the indicator uses the chart's current timeframe. When disabled, it uses the custom resolution specified below.
- Use Different Timeframe?: Allows the selection of a specific timeframe (e.g., Daily, Weekly) for the moving average calculations regardless of the chart view.
- Short Period Moving Average: Sets the lookback period for the faster moving average.
- Long Period Moving Average: Sets the lookback period for the slower moving average.
- Moving Average Calculation: Selects the mathematical model for the averages (SMA, EMA, WMA, or Linear Regression).
FAQ
How do I interpret the different colors on the moving average lines? The lines turn green when the moving average is currently higher than its previous value (trending up), red when it is lower (trending down), and blue when there is no change.
What is the benefit of using the Linear Regression option? The Linear Regression setting attempts to fit a straight line through the price data, which can often react faster to price changes than a standard SMA while remaining smoother than an EMA.
How do I access the Moving Average Cross Alert? 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.