Moving Average Cross Strategy
Jul 4, 2018

The Moving Average Cross Strategy tool provides a comprehensive backtesting framework that combines exponential moving average crossovers with secondary momentum and volatility filters to identify trend reversal opportunities.
Usage
The Usage section describes how the script can be used to evaluate trading performance. This strategy primarily identifies entries based on the interaction between a Fast EMA and a Slow EMA. When the Fast EMA crosses above the Slow EMA, a long entry is triggered; conversely, a cross below triggers a short entry.
To optimize the strategy, users can adjust the source and length of the moving averages to fit specific timeframes or assets. The script also includes visual references for the 200 SMA, Bollinger Bands, and VWAP, allowing traders to confirm if price action aligns with broader market trends before executing trades. Strategy performance can be monitored via the Strategy Tester tab, using the built-in Profit and Stop levels to manage risk.
Details
The script integrates several technical analysis concepts to provide a holistic view of market conditions:
- Moving Average Crossovers: Uses Exponential Moving Averages (EMA) to generate primary entry signals based on trend shifts.
- Momentum Filtering: Incorporates the Williams %R indicator to track oversold and overbought conditions.
- Volatility and Trend Context: Plots Bollinger Bands and the VWAP to assist in identifying price deviation and volume-weighted average price levels.
- Risk Management: Implements automated exit logic based on user-defined profit targets and stop-loss levels, calculated relative to the entry price.
Settings
Moving Averages
- Fast MA Source: Determines the price data used for the fast EMA calculation.
- Fast MA Period: Sets the lookback length for the fast EMA.
- Slow MA Source: Determines the price data used for the slow EMA calculation.
- Slow MA Period: Sets the lookback length for the slow EMA.
- 200 MA Length: Sets the period for the long-term Simple Moving Average.
- 200 MA Source: Determines the price data used for the 200 SMA.
Bollinger Bands
- BB Length: The period used for the Bollinger Bands basis (SMA).
- BB Source: The price source for Bollinger Band calculations.
- BB Multiplier: The standard deviation multiplier for the upper and lower bands.
VWAP
- VWAP Source: The price source (typically HLC3) used for the Volume Weighted Average Price calculation.
Strategy Limits
- Profit Level: The target profit amount for the strategy exit.
- Stop Level: The maximum loss allowed before a stop-loss order is triggered.
- Leverage: Adjusts the simulated leverage for the backtest.
Williams %R
- W%R Length: The lookback period for the Williams %R calculation.
- W%R Source: The price source for the Williams %R.
- W%R Oversold: The threshold level identifying oversold conditions.
- W%R Overbought: The threshold level identifying overbought conditions.
FAQ
How do I adjust the entry signals? You can modify the Fast and Slow MA Period settings in the "Moving Averages" group. Shorter periods will result in more frequent signals, while longer periods will filter out minor price fluctuations.
What triggers the automated exit? The strategy exits a position when either the user-defined Profit Level or Stop Level is reached, ensuring disciplined risk management during backtesting.
How can I access the Moving Average Cross Strategy? 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.