Building a Dual Moving Average Trend Strategy in a Backtest
Summary
This tutorial outlines a conventional trend-following strategy for Chinese stocks using short- and long-period moving averages. It describes entering when the short average is above the long average and exiting when it falls below, with trades placed at the next session’s open. It then walks through preparing historical data, creating signals, setting transaction costs and portfolio limits, and handling periodic rebalancing in a trading engine.
The example describes a five-stock, equal-weight portfolio, a three-day holding setting, and a handler that checks signals on scheduled rebalance days. There is an internal inconsistency: the prose refers to a five-day and ten-day average, while another passage mentions a fifty-day average; the sample signal query uses five and ten days. The article provides implementation guidance but no backtest results or evidence that the approach is profitable. Its claims about long-term profitability are unsupported in the supplied text, and costs, slippage, stock selection, and execution assumptions would need careful evaluation.
Key ideas
- A dual moving average rule uses the short average above the long average as a buy condition and the reverse as a sell condition.
- The example places trades at the next session’s open after signals are formed from closing prices.
- The portfolio process includes periodic rebalancing, a cap on holdings, and equal target weights.
- Transaction fees and slippage assumptions belong in the backtest configuration.
- The source conflicts on the long average period and provides no performance results to validate the strategy.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.