A moving-average allocation rule compares an asset's price with an average of its earlier prices. It holds the asset when the signal is positive and uses a specified alternative when it is not. The rule is easy to describe, but its timing and data choices need to be precise.
Define the illustrative rule
This example uses SPY as the equity holding and BIL as the alternative:
- At each month-end decision, calculate the mean of the latest 200 available trading-day closes.
- Choose SPY when its closing price is above that mean; otherwise choose BIL.
- Execute no earlier than the next available session after the signal is known.
- Specify the price basis, warm-up period, missing-data treatment and costs.
BIL is an ETF holding, not cash in a brokerage account. A 200-day average differs from a 10-month average of month-end prices. Do not treat their results as interchangeable.
Inspect the tradeoffs
A rule can move out of a holding during a sustained decline, but it can also sell after a fall and miss a rebound. Repeated crossings can create whipsaws and trading costs. Neither a smaller drawdown nor a higher return follows from the rule alone.
For broader research context, A Century of Evidence on Trend-Following Investing studies trend following. Its assets and methods are separate from this illustrative ETF prompt; its results are not evidence of a specific ENSEMBLE run.
Build, inspect and compare
The prompt is a proposed specification, not a recorded result. Review the generated code in your own model and verify that decisions cannot use future data. Build time depends on the requested work and runtime conditions.
Inspect the successful run's window, data date, warnings, allocation changes and drawdowns. Compare with SPY over the same dates. Do not assume a fixed time in market, trade count or drawdown improvement.
Test one change at a time: a different lookback, weekly evaluation, or an explicit entry/exit buffer. Keep other choices fixed. Use saved test runs and inspect the differences before adopting new defaults. The portfolio walkthrough explains that process; metrics explained describes the current reporting conventions.
Maintain the reviewed allocation
Enable automatic refreshes only after reviewing the model. Check that a refresh succeeded and inspect its latest data date before using its allocation. A model's output is research; it does not submit brokerage orders.
ENSEMBLE is research software. Backtests are hypothetical and past performance does not guarantee future results.
Frequently asked questions
- Is a 200-day average the same as a 10-month average?
- No. They use different observations and can produce different signals. State the sampling frequency and lookback explicitly before comparing them.
- Does this strategy beat buy and hold?
- That requires a particular dataset, window and implementation to evaluate. This page makes no performance claim for the illustrative prompt. Compare a saved run with a benchmark over identical dates.
- Why evaluate only at month end?
- It is one explicit scheduling choice. Less frequent decisions may reduce some trading but also delay responses. Test the difference rather than assuming a benefit.
Related
- StrategiesDual momentum: the rules, the evidence, and a backtest
Define relative and absolute momentum separately, inspect a public model, and compare a parameter change. The example explains the research workflow without promising a historical or future result.
- StrategiesThe 60/40 portfolio: rules, variants, and a backtest
Define a stock-and-bond allocation, inspect a public 60/40 model, and test rebalancing or asset changes over matched dates. Learn what the model shows and what it leaves out.
- BacktestingCommon backtesting mistakes and how to avoid them
The ways a backtest lies: lookahead bias, survivorship bias, overfitting, ignored costs, short or regime-limited samples, and misread metrics. What each one looks like, how to detect it, and what a backtesting tool can and cannot protect you from.
- BacktestingBacktest metrics explained: CAGR, volatility, Sharpe ratio, and max drawdown
Read ENSEMBLE backtest metrics with their actual conventions: CAGR, annualized volatility, a zero-risk-free Sharpe calculation, maximum drawdown and trading activity. Compare matched windows and inspect assumptions.