Skip to content
All library documents

Dual Moving Average Crossovers with Reversals and Stop Losses

Code Quant course library

Summary

The strategy uses a fast and slow moving average to trade both directions in a USD margined futures contract. It checks completed bars for a bullish or bearish crossover, entering a position when flat and reversing an existing position when the signal points the other way. Signals rely on earlier bar values to reduce the effect of changing averages within an unfinished bar.

Position size is derived from current account equity and contract value. A long position is stopped when the bar's low reaches a configured fraction of entry price; a short is stopped when its high reaches a configured multiple. The implementation updates recorded profit and equity after closing trades, and limits repeat orders on a bar after a stop. It describes execution and accounting mechanics, but gives no performance results or evidence that the parameters are profitable. Fees, slippage, leverage constraints, and broader risk controls are not addressed, so the approach requires careful testing before practical use.

Key ideas

  • A fast and slow moving average crossover supplies long and short entry signals.
  • Signals are based on completed bar values to avoid reacting to unstable averages.
  • An opposite crossover closes the current position and opens one in the other direction.
  • Order quantity scales with account equity relative to contract value.
  • Stops use bar highs or lows and configurable thresholds tied to entry price.
  • The description provides no performance evidence and omits trading costs and broader risk analysis.

Tags

From a private course collection; the original is not published.