Custom Trading System logo
NinjaTrader indicators, automated trading systems
Custom development and premium support
Connect with us

Ever wanted a moving average crossover strategy with extra features?

Moving Average Crossover

Ever wanted an MA crossover strategy with extra features? Build your own moving average system with 10+ new options.

[this div will be converted to an iframe]
Moving Average Crossover

Moving Average Crossover $69.00

Ever wanted an MA crossover strategy with extra features? Build your own moving average system with 10+ new options.

Your price: $69.00

Before buying our products you must accept our Terms & Conditions. All sales are final.


We took the classic moving average crossover algorithm and mixed it with the most popular trading features.

Essentially, it's a universal Moving Average Crossover strategy. While the core idea remains the same, you may turn additional features on and build your custom Moving Average trading system.

For example, use separate fast and slow averages, add AutoTrail functionality, define Daily targets, or even invert the signals. The strategy has built-in MA indicators, so you don't have to add them separately to the chart. Of course, you can hide them at any moment.

Moving Average Crossover is a perfect multipurpose strategy: back-test your trading ideas, optimize the strategy parameters, or trade live account - the strategy fits all these roles.

Works on any market and any bar type.

Features overview

  • Various MA types: DEMA, SMA, EMA, HMA, TEMA, TMA, VWMA, WMA, ZLEMA.
  • Separate fast and slow MA. The fast MA can be EMA(7) and the slow MA can be SMA(28).
  • Profit target and stop loss. Set brackets for individual trades.
  • Daily profit target and stop loss. Once one of those limits is reached the strategy stops trading until the next trading session.
  • Auto trailing stop. An option to have an auto trailing stop with custom profit trigger, stop loss and frequency.
  • Working hours. Set the time period when the strategy should be active, it will not trade outside of this period.
  • Invert signals. Enter long when signal is short and vice versa. Why not to experiment?
  • Limit or Market entry orders. Control the slippage and use Limit orders for entries or always enter a position with Market order
  • And more: Bid/Ask filter, custom colors, show/hide MA indicators from chart etc.

Complete parameter list

  • StartTime and EndTime. Time when the strategy will submit the orders. Once it gets to EndTime it cancels the working orders and closes all positions. Example: 9:30 and 15:20 or 18:45 and 10:30 (for overnight sessions).
  • FastMAType and SlowMAType. MA types for fast and slow moving averages. Example: EMA and SMA.
  • FastMAPeriod and SlowMAPeriod. MA periods for fast and slow moving averages. Example: 7 and 28.
  • MaximumDailyProfit and MaximumDailyLoss. Daily limits, if the strategy reaches one of them it will not trade until the next trading session. Set to zero to disable the feature.
  • MaxBidAskSpread. Sometimes it's not desirable to enter a position when the spread is too big. This parameter helps you to avoid the trades when Bid Ask Spread is greater than this number, in ticks. Set to 0 to disable the feature.
  • EntryOrderType. Set entry order type to Limit or Market. Let us know if you need other types :)
  • LimitPriceOffset. Add the specified number of ticks to entry price. Has no effect on market orders.
  • LimitOrderExpirationPeriod. A limit order can work for a long time without filling so there must be a way to cancel too old orders. Set this parameter to 5 to cancel an entry if it's not filled after 5 bars. Has no effect on market orders.
  • TradingDirection. Trade only long, only short, or both.
  • ProfitTarget and StopLoss. OCO brackets for entry. For example, set it to 10 and 20 to have 10-ticks profit target and 20-tick stop loss attached to each entry. Set to 0 to disable the feature.
  • AutoTrailProfitTrigger, AutoTrailStopLoss, and AutoTrailFrequency. These define trailing stop. It works the same way as a standard NinjaTrader AutoTrail Stop. A trailing stop (AutoTrailStopLoss ticks below the Bid/Ask) will be submitted once the position profit reaches AutoTrailProfitTrigger. Then, every time the profit gets increased by the next AutoTrailFrequency ticks, the trailing stop loss gets updated. To disable the feature set AutoTrailStopLoss to 0.
  • ShowMAOnChart. Set to False to hide the fast and slow moving average indicators from chart.
  • MinCrossThreshold. Entries are submitted when the fast MA crosses above/below the slow MA by at least X ticks.
  • NoReversals. When True, the strategy will not revert positions. Instead, it will wait until they are exited by profit target, stop loss, trailing stop or Exit On Close.
  • InvertSignals. When True, crossover signals will be inverted, i.e. a long signal would cause a short entry while short signal would cause a long entry.

How to use

The strategy is ready to work out-of-the-box on any market or time frame. You can enable additional options if needed. Don't be overwhelmed by the number of parameters: you can set most of them to zero to deactivate the features behind them.

Below is an example on how to use our Moving Average Crossover strategy.

Example: Classic Moving Average Crossover

A classic way tells us to buy when the fast MA crosses above the slow MA and sell when the fast MA crosses the slow MA below. If we are in position, the position gets reverted. Tweak the following parameters if you'd like and leave the others default:

  • Set the desired FastMAPeriod and SlowMAPeriod
  • Set the desired MaximumDailyProfit and MaximumDailyLoss, for example, both equal to 250.
  • Set the desired MinCrossThreshold. For example, if you set it to 5 then the entries will be triggered only when the fast MA crosses above/below the slow MA by at least 5 ticks.

You can now back-test the strategy, optimize it, run it on demo or real account. Of course, feel free to set you favourite set of parameters to achieve the optimal performance.


  • This strategy requires NinjaTrader version 7


  1. Save the zip-file (no need to unzip) to the location of your choice

  2. Go to menu Control Center -> File -> Utilities -> Import NinjaScript...

  3. Select the saved zip-file in the opened dialog

  4. If everything is OK you will see a confirmation (otherwise an error will be displayed)

  5. Restart NinjaTrader and you are good to go!