GMS: Moving Average Crossover Strategy
Mar 3, 2020

The GMS: Moving Average Crossover Strategy tool provides a versatile framework for generating and backtesting trading signals based on the intersection of two customizable moving averages combined with a robust trend-filtering mechanism.
Usage
The strategy is designed to identify momentum shifts by monitoring the crossover of a "Fast" and "Slow" moving average. Users can choose between four different calculation methods—SMA, EMA, WMA, and VWMA—for either moving average to suit different market conditions or asset classes.
The script allows for granular control over trade execution:
- Directional Bias: Traders can toggle between "Long Only," "Short Only," or "Both" to align with their specific market outlook.
- Trend Filtering: By enabling the Trend SMA Filter, the strategy will only initiate a Long position if the price is above the Trend SMA (or Short if below), helping to avoid counter-trend signals.
- Risk Management: The strategy includes built-in Profit Target and Stop Loss inputs defined by percentages, allowing for automated exit management alongside the standard crossover exit logic.
Details
The strategy executes an entry when the primary moving average (MA1) crosses over or under the secondary moving average (MA2). If the trend filter is active, the script evaluates the relationship between the closing price and a Simple Moving Average of a specified length (defaulting to 200) before confirming an entry. It is important to note that the trend filter only applies to trade entries; exits are triggered either by a reverse crossover or by hitting the predefined profit/loss percentage thresholds.
The inclusion of Volume Weighted Moving Averages (VWMA) and Weighted Moving Averages (WMA) allows users to incorporate volume data and price sensitivity into the crossover logic, providing more technical depth than standard SMA/EMA systems.
Settings
- Long Only or Short Only or Both?: Filters the strategy to only execute trades in the selected direction.
- Which Moving Average? (1 & 2): Selects the calculation method (SMA, EMA, WMA, or VWMA) for the two crossover lines.
- Moving Average Length (1 & 2): Sets the lookback period for the primary and secondary moving averages.
- Trend SMA Filter?: Determines if price must be "Above" or "Below" the trend SMA for an entry to trigger, or if the filter should be ignored.
- Trend SMA Length: Defines the lookback period for the filter SMA.
- Profit Target On/Off: Enables or disables the percentage-based take-profit exit.
- Profit Target %: The percentage gain required to trigger a profit-taking exit.
- Stop Loss On/Off: Enables or disables the percentage-based stop-loss exit.
- Stop Loss %: The percentage decline (expressed as a negative value) required to trigger a protective exit.
FAQ
Which moving average types are supported? The strategy supports Simple Moving Averages (SMA), Exponential Moving Averages (EMA), Weighted Moving Averages (WMA), and Volume Weighted Moving Averages (VWMA).
Does the trend filter affect trade exits? No, the trend filter is only checked during the entry phase. Once a trade is active, it will remain open until a reverse crossover occurs or the profit/loss targets are met, regardless of the price's position relative to the trend SMA.
How do I access this script? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.
Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.
Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.
As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.
Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.
Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.
This does not represent our full Disclaimer. Please read our full disclaimer.
© 2026 LuxAlgo Global, LLC.

