Building and Backtesting a Moving Average Crossover Strategy
Summary
This tutorial walks through building a basic quantitative strategy for a single Chinese equity. It uses a five-day and a twenty-day moving average of adjusted daily closing prices: the strategy targets a fully invested position when the shorter average is higher, and exits when it is lower and a position is held. The guide explains the platform’s initialization and recurring execution functions, historical price retrieval, calculating averages, checking holdings, submitting orders, and logging signals.
It then describes running the strategy through historical data to inspect performance information such as the return curve, risk measures, holdings, trades, and logs, before connecting it to simulated trading. The document teaches a simple implementation workflow, but provides no performance results or evidence that the crossover is profitable. The example’s full-investment sizing and reliance on moving-average comparisons are basic choices; transaction costs, slippage, robustness, and other risk controls are not discussed. It is an introductory platform tutorial rather than a strategy evaluation.
Key ideas
- A complete simple strategy specifies both the instrument and the conditions for trading it.
- The example buys when a short moving average exceeds a longer one and exits when the relationship reverses.
- Historical closing prices are retrieved to calculate the moving averages before evaluating a signal.
- The tutorial demonstrates target-weight and target-share orders, with a full-investment buy and a zero-share exit.
- Backtesting and simulated trading are presented as steps for checking execution and observing strategy behavior.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.