Skip to content
All library documents

Building a Moving Average Trend Strategy with Entry and Exit Rules

Article FMZ forum · Author: 善

Summary

This tutorial turns a moving average idea into explicit rules for a long and short strategy. It uses a 10-period average as the short-term measure and a 50-period average as the longer trend filter. Long entries require price and the short average to be above the long average, with the long average rising; short entries reverse the price and average relationships and require the long average to be falling. Position exits use price crossing the long average, a change in the short-to-long average relationship, or a reversal in the long average’s direction.

The article explains how prior average values can be compared to identify a rising or falling trend, and describes expressing the rules with logical conditions and order actions. It offers no backtest, market, or performance evidence, and includes inconsistencies between some prose rules and the sample expressions. The strategy is presented as a programming example; stop-loss and take-profit rules are left as exercises, and transaction costs and position sizing are not addressed.

Key ideas

  • A short and long moving average can help filter false signals from a basic price-versus-average rule.
  • The example uses 10-period and 50-period averages and checks the longer average’s recent direction.
  • Entry rules combine price location, the relationship between averages, and trend direction.
  • Exit rules close positions when price or moving-average relationships weaken or reverse.
  • The tutorial explains rule implementation but supplies no evidence of trading performance.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.