A 12-Month Momentum Backtest with SPY, IEF, and GLD: Comparing Baselines from 2007 to 2025
Execution record: 2026-10-19
This educational backtest compares buy-and-hold with 12-month momentum using historical adjusted closing prices for SPY, IEF, and GLD. It records a calculation implemented and run on that date; it does not recast experiments planned in earlier articles as work already performed then. It does not validate live trading or AI model performance.
“Would holding only ETFs with positive 12-month returns beat buying them at the start and continuing to hold them?”
I calculated this comparison using historical data for SPY, IEF, and GLD. The evaluation period runs from 2007 through 2025, starting with $10,000.
With one-way transaction costs of 10 basis points, the results were as follows. Ten basis points means 0.1% of traded value, applied separately to purchases and sales.
| Strategy | Ending value | Annualized return | Maximum drawdown |
|---|---|---|---|
| Buy-and-hold | $50,228.04 | 8.87% | -20.75% |
| 12-month momentum | $46,361.29 | 8.41% | -24.16% |
Under these conditions, momentum was less favorable than buy-and-hold on both return and maximum drawdown. Its return was also lower with transaction costs set to zero.
This article describes the conditions behind those results, the accounting in the transaction ledger, and what the public materials can verify. It does not claim that other periods and assets would produce the same outcome.
1. Conditions used to compare the two strategies
| Item | Fixed condition |
|---|---|
| Assets | SPY, IEF, and GLD, in USD |
| Input data | Yahoo Finance daily adjclose, 2005-01-03 through 2025-12-31 |
| Input rows | 5,283 per asset |
| Evaluation period | Entry at the 2007-01-03 close; liquidation at the 2025-12-31 close |
| Evaluation trading days | 4,780 |
| Initial capital | $10,000 |
| Buy-and-hold | Buy each asset at a one-third weight initially, make no interim rebalances, and liquidate at the end |
| 12-month momentum | Select assets whose month-end adjusted close exceeds their adjusted close 12 month-ends earlier, and hold them at equal weights |
| Cash allocation | Hold all cash if no asset qualifies |
| Execution timing | Execute month-end signals at the next observed trading day's close |
| Transaction costs | 0, 5, 10, or 20 basis points on each purchase and sale |
| Where costs apply | Initial entry, interim rebalances, and final liquidation |
| Other assumptions | Zero interest on cash; fractional units allowed |
| Exclusions | Taxes, currency conversion fees, market impact, and additional spreads |
The momentum rule is:
12-month return = current month-end adjusted close / adjusted close 12 month-ends earlier - 1Only assets with a return greater than zero qualify. If all three qualify, each receives one-third; if two qualify, each receives one-half; if one qualifies, it receives the full allocation. If all returns are zero or negative, the portfolio stays in cash.
Comparing against 12 month-ends earlier requires 13 month-end observations. The input begins in 2005, but 2005–2006 serves as preparation for signal calculation before evaluation starts.
The calculation does not use a month-end price both to generate a signal and to execute it immediately. Target weights are applied at the next observed trading day's close; price changes through that close belong to the existing holdings.
The evaluation period, assets, and cost rates are conditions of this educational run. This is not a preregistered independent out-of-sample validation. In this work, I did not search multiple periods or thresholds and select only favorable results.
2. What using adjusted closes means
The calculation uses Yahoo Finance adjclose. The provider's explanation of adjusted closing prices is available in Yahoo Help.
The runner treats this series as a price index approximating dividend reinvestment. Accordingly, units in the transaction ledger are adjusted-price accounting units, not actual ETF share counts.
That distinction leads to two rules:
- Do not add separate dividend cash flows.
- Do not interpret the recorded units as quantities to order in a real account.
Adding dividend cash flows again to a calculation whose prices already reflect their effect can double-count them. Transaction costs are also an approximation, applied to traded value calculated from these adjusted prices.
The input is historical data downloaded at execution time. It does not reconstruct the data versions available at each historical point or actual execution prices.
Before calculating, the runner checks:
- Whether all three assets have the same date set.
- Whether there are duplicate dates.
- Whether every price is present, finite, and positive.
It stops if these conditions fail. It does not fill missing values arbitrarily or continue using only the dates shared by all three assets.
These checks establish input structure and calculability, not an independent validation of the provider's prices. Asset-selection bias and possible provider revisions or errors remain limitations.
3. Results: momentum did not lead even without transaction costs
| Strategy | One-way cost | Ending value ($) | Annualized return | Maximum drawdown |
|---|---|---|---|---|
| Buy-and-hold | 0bp | 50,328.59 | 8.88% | -20.75% |
| Buy-and-hold | 5bp | 50,278.29 | 8.88% | -20.75% |
| Buy-and-hold | 10bp | 50,228.04 | 8.87% | -20.75% |
| Buy-and-hold | 20bp | 50,127.68 | 8.86% | -20.75% |
| 12-month momentum | 0bp | 48,990.04 | 8.73% | -23.55% |
| 12-month momentum | 5bp | 47,657.55 | 8.57% | -23.86% |
| 12-month momentum | 10bp | 46,361.29 | 8.41% | -24.16% |
| 12-month momentum | 20bp | 43,873.58 | 8.10% | -24.78% |
Annualized return is calculated as follows:
Elapsed years = calendar days from evaluation start to end / 365.25Annualized return = (ending wealth / 10,000) ** (1 / elapsed years) - 1Maximum drawdown measures each daily portfolio value's decline from its preceding peak and takes the largest decline. The starting $10,000 is included as the initial reference point, and final liquidation costs are reflected in ending value.
At 10bp, the difference in ending wealth was $3,866.75.
The momentum ledger contains 228 monthly target-weight application events, including initial entry, plus one final liquidation. Buy-and-hold has only initial entry and final liquidation. These event counts are not counts of individual asset orders.
What the results establish, and what remains unexplained
| Category | What this run supports |
|---|---|
| Observed fact | Momentum had lower ending wealth at all four cost rates. |
| Observed fact | Momentum had a lower annualized return even at 0bp. |
| Observed fact | Momentum had a larger maximum drawdown at all four cost rates. |
| Causes not isolated | How much asset selection, cash holding, and equal-weight rebalancing each contributed |
| Outside this calculation | Whether other periods and assets behave similarly, or whether the result holds in the future |
Because the gap exists even without costs, costs alone cannot explain why momentum lagged.
Nor can I conclude that cash holding or exclusion of a particular asset caused the result. Asset selection, cash weights, monthly equal-weight rebalancing, and drifting buy-and-hold weights all operate together in this comparison. I did not run separate experiments changing each factor to decompose its contribution.
4. Reading the accounting through one ledger entry
A summary table does not show how signals become trades and costs.
The following is the 2007-02-01 entry from the public momentum 10bp transaction ledger. It presents existing ledger values in a more readable form; it is not a new experiment.
| Item | Ledger entry |
|---|---|
| Signal date | 2007-01-31 |
| Target-weight execution | 2007-02-01 close |
| Target weights | One-third each in SPY, IEF, and GLD |
| Pre-trade portfolio value | Approximately $10,198.184057 |
| Total purchase and sale notional | Approximately $189.531536 |
| One-way cost rate | 0.1%, or 10bp |
| Transaction cost | Approximately $0.189532 |
| Post-trade cash | $0 |
| Post-trade units | SPY approximately 33.695133; IEF 68.798155; GLD 52.120997 |
The cost is not 0.1% of total portfolio value. It is the cost rate multiplied by the total value actually bought and sold.
$189.531536 × 0.001 ≈ $0.189532Trades can occur even when target weights remain one-third each. If asset prices move differently while holding units stay fixed, portfolio weights drift. Restoring one-third weights requires purchases and sales.
The units in this table use adjusted-price accounting. They are not a record of trading those share quantities in a real account.
5. Accounting rules checked before interpreting returns
Buy-and-hold preserves holding units
Weights change over time even when each asset initially receives one-third.
Averaging the three daily asset returns at fixed one-third weights would calculate a strategy rebalanced daily to equal weights. This buy-and-hold calculation instead keeps units fixed after entry and lets weights move with prices.
Momentum targets weights after paying transaction costs
Buying up to the full pre-cost portfolio value and only then deducting fees can exceed available cash.
The runner solves the following relation by bisection, calculating post-cost wealth and target units together:
Transaction cost= one-way cost rate × Σ |target weight × post-cost wealth - current holding value|Post-cost wealth + transaction cost= pre-trade wealthChecks recorded at execution time
The 2026-10-19 run passed these nine unit tests:
- Initial entry costs.
- Liquidation after a price change.
- Zero cost when no trade occurs.
- Wealth conservation across trading.
- Buy-and-hold comparison with an independent formula.
- Rejection of invalid prices.
- Attribution of execution-day returns.
- Drawdown including initial capital.
- Twelve-month month-end signals and next-trading-day execution.
Buy-and-hold results on the actual data were also compared with an independent formula at all four cost rates. A further check removed rows after 2021 and confirmed that signals already fixed before that cutoff did not change.
These checks cover parts of the specified accounting rules. They do not guarantee the absence of every implementation error or establish profitability.
6. What the public materials let you check
The materials are available here:
- Complete code, tests, and outputs ZIP
- English execution guide
- Results JSON and input hashes
- Momentum 10bp daily equity
- Momentum 10bp transaction ledger
The ZIP includes code, tests, and results for two strategies at four cost rates. It does not include raw price data.
Python 3.9 or later is required, with only the standard library and no additional packages. The recorded execution environment was macOS with Python 3.14.5.
Extract the ZIP into a separate folder and run the following commands from the directory containing backtest.py and test_backtest.py.
First: unit tests of the accounting rules
python3 -m unittest -vThis checks accounting and signal rules using the examples in the tests. It does not download prices or reproduce the published results.
If a test fails, examine that failure before continuing.
Second: download prices and calculate new results
python3 backtest.py --download --data market-inputs --out my-resultsThis downloads prices from Yahoo into market-inputs and writes calculated outputs to my-results.
Both must be new paths that do not already exist. Use different names if you have run the command before.
Downloading requires network and provider access. If it fails partway through, do not treat partial files as a complete input set; retry with a new input directory.
Third: check the new outputs and input match
python3 verify.py --data market-inputs --results my-resultsThis recomputes results from the supplied input and compares them with my-results. It also checks buy-and-hold with a separate formula at the four cost rates.
Successful checks print:
PASS: 17 regenerated output files and 4 closed-form comparisonsThis PASS alone does not mean the results match the published run.
It means the outputs generated from the input just used match a recalculation, and the independent buy-and-hold formula checks passed.
Check the following line separately:
Published input matches: TrueIt may instead say:
Published input matches: False| Output | Meaning |
|---|---|
PASS | Recomputed outputs for the specified input match the specified results directory, and independent formula checks pass. |
Published input matches: True | The SHA-256 of normalized dates and prices matches the published input record. |
Published input matches: False | The input differs from the published run; classify this as a calculation using new data. |
If the input matches, compare the results in my-results/results.json with the published reference-results/results.json, including ending value, annualized return, and maximum drawdown.
With --results my-results, the 17-file comparison in the current verify.py is between newly generated outputs and recomputed outputs. It should not be mistaken for a comparison against the entire published reference-results directory.
Downloading again may not reproduce the same numbers
Provider revisions or access restrictions can change downloaded values or make downloads fail.
Input matching uses normalized_prices_sha256. A raw JSON hash can change because of metadata unrelated to prices, so a different raw-file hash alone does not establish different prices.
The verifier also compares output files byte for byte. Differences in floating-point representation between Python versions can cause a file mismatch. When a mismatch occurs, examine the input, environment, and numerical differences separately.
The original price snapshot is preserved in a private backup. Since that snapshot is not part of the public materials, external readers are not guaranteed to obtain the same input again.
Record passing code checks, calculating with newly obtained input, and reproducing the published results as separate outcomes.
7. What this calculation answered, and the questions left open
This run calculated buy-and-hold and 12-month momentum through to their final results under fixed price data and trading rules.
For the selected period and assets, momentum showed neither a higher return nor a smaller maximum drawdown. Its return was lower even without transaction costs, so costs alone could not explain the difference.
The following questions remain unanswered:
- How much did cash holding, asset selection, and equal-weight rebalancing each contribute?
- Do other evaluation periods or price datasets produce similar results?
- How much does including cash interest change the outcome?
- What changes if logistic regression or tree models are added under the same comparison rules?
These require separate experiments. Later design articles and synthetic-data checks should not be reinterpreted as performance validation on this market dataset.
Further experiments should preserve these conditions and results, recording changed assumptions and new results separately. This result is a baseline for those comparisons, not an investment recommendation or evidence of future returns.
Report an error or share feedback
Open a draft with this article’s title and URL. Review the message and recipient before sending.
Open email draftIf no email app opens, copy these details into your usual email service.
Related posts
Quant & Data Research Do Transaction Costs Change the Conclusion? Accounting for Entry, Full Replacement, and Liquidation
Account for purchase budgets and costs at entry, full replacement, and liquidation; check costs, turnover, and cash constraints in a synthetic ledger.
Quant & Data Research Start a Backtest with Positions, Not Returns: One-Period Accounting for Buy-and-Hold and Momentum
Calculate quantities, cash, and valuation from synthetic prices, then detect unrequested equal-weight rebalancing with a quantity invariant.