How to Backtest a Portfolio in 7 Steps (Weights, Rebalancing, Costs)
July 12, 2026 · Agenttrading
To backtest a portfolio, write the holdings as exact weights that sum to 100, choose a rebalance rule, run the mix on split- and dividend-adjusted daily data across at least 20 years, charge about 0.1% per trade on every rebalance, and compare the result against simply holding a broad index fund. The comparison against the index is the step most people skip, and it is the one that decides whether the portfolio was worth building.
Backtesting a single stock rule and backtesting a portfolio are different exercises. A single rule asks whether an idea worked. A portfolio asks something harder: whether the holdings, in these proportions, rebalanced this way, did better than the boring alternative after costs. Most do not. Here is how to run the test so it can actually tell you that.
Step 1: Write the portfolio as exact weights
A portfolio you can test looks like this: 60% SPY, 30% QQQ, 10% GLD. A portfolio you cannot test looks like this: "mostly index funds, some tech, a bit of gold." The weights have to sum to 100 and every position needs a ticker, because the backtest has to buy something on a specific day at a specific price.
Two things people leave out at this stage, and both change the answer:
- Cash. If the plan is to hold 10% cash, that is a position, and it earns the risk-free rate. Ignoring it flatters the portfolio in a crash and drags it in a bull market.
- The start date. A portfolio started in March 2009 looks like genius. The same portfolio started in October 2007 looks like a mistake. Fix the start date before you look at any result, or you will keep sliding it until the chart is pretty.
Step 2: Decide the rebalance rule, because it is part of the strategy
Rebalancing is not housekeeping. It is an active decision that mechanically sells winners and buys losers, and how often you do it materially changes both the return and the cost. The realistic options:
| Rebalance rule | What it does | Cost drag |
|---|---|---|
| Never (buy and hold the initial mix) | Lets winners run. The portfolio drifts toward whatever performed best, so a 60/40 can quietly become an 80/20 over a decade. | Almost none after the initial buy. |
| Annually | The common default. Captures most of the risk-control benefit of rebalancing with modest trading. | Low. One round of trades a year. |
| Quarterly | Keeps weights tight to target. Rarely adds return over annual, and often loses to it after costs. | Roughly four times annual. |
| Drift bands (for example, 5 percentage points) | Trades only when a weight strays past a threshold. Efficient, and it ignores calm periods entirely. | Variable. Low in quiet markets, higher in volatile ones. |
Whichever you choose, state it before the test runs. If you try all four and keep the best, you have not backtested a portfolio, you have gone shopping for a number.
Step 3: Use split- and dividend-adjusted data
This is the step that silently ruins amateur backtests. Raw closing prices do not include dividends, and they break at every stock split. Test a dividend-heavy portfolio on unadjusted prices and you can understate its total return by 2 to 3 percentage points a year, which compounds into an enormous error across two decades.
You need daily prices adjusted for both splits and dividends, with dividends treated as reinvested. If you are pulling data yourself, verify one thing before trusting the whole set: pick a stock that split recently, look at the price on the day of the split, and confirm there is no cliff in the series. If there is a cliff, the data is unadjusted and every result you compute from it is wrong.
Step 4: Cover 20+ years so the mix meets real bear markets
A ten-year backtest ending today covers a period in which almost everything went up. That is not a test, it is a tailwind. Twenty-plus years forces the allocation through the dot-com unwind, the 2008 financial crisis, and the 2020 crash, which is the minimum evidence needed to judge whether an allocation survives regimes or just one favorable decade.
This matters more for portfolios than for single rules, because the whole promise of diversification is that the holdings will not fall together. That promise is only tested in a crisis, and correlations have a habit of converging toward 1 exactly when you needed them not to. If your backtest window contains no crisis, it has not examined the one claim the portfolio is making.
Step 5: Charge realistic costs on every rebalance
Use roughly 0.1% per trade for liquid US stocks and ETFs, covering spread and slippage even in a zero-commission account. The trap specific to portfolios is that a rebalance is not one trade. Rebalancing a five-position portfolio touches several positions at once, so a quarterly schedule can mean 20 or more trades a year on a portfolio that felt passive.
Add expense ratios too. A fund charging 0.75% a year against an index fund charging 0.03% starts every year 0.72 percentage points behind, before it has done anything. Over 20 years that gap alone is enormous, and it is the most predictable number in the whole exercise.
Step 6: Benchmark against a plain index fund, not against zero
Here is the discipline that separates a real portfolio backtest from a flattering one. A result of "9% a year with a 35% maximum drawdown" is meaningless on its own. It only becomes information when you put it next to what 100% SPY did over the identical period, with the same costs and the same start date.
Run that comparison and the outcome is frequently deflating: the carefully constructed multi-asset mix returns less than the index fund, with a drawdown that was only modestly shallower. That is not a failed backtest. That is the backtest working, and it is the most valuable answer it can give you, because it saves you from paying complexity costs for a decade to underperform something you could have bought in one click.
The honest way to read the comparison is on two axes at once, return and worst drawdown. A mix that returns 1 point less per year but cuts the worst drawdown from 55% to 35% may be the better portfolio for a person who would have panic-sold at the bottom of the deeper one. Backtests measure returns; they cannot measure whether you would have held on.
Past performance does not guarantee future results. For educational and informational purposes only. Not financial advice. Consult a licensed advisor.
Step 7: Read the drawdown, then stress the weights
Find the worst peak-to-trough decline in the portfolio's history, and record three numbers: how deep it went, how long the fall lasted, and how long it took to recover the old high. That last number is the one that breaks people. A 50% drawdown that recovers in eight months is survivable. A 45% drawdown that takes five years to recover is where investors abandon plans.
Then stress the allocation. Nudge each weight by 5 to 10 percentage points and rerun. If shifting 60/30/10 to 55/35/10 materially changes the verdict, the portfolio is fit to the exact history you tested and there is no reason to believe those precise weights carry any information about the future. A robust allocation degrades gently. A fragile one falls apart.
If your process is to compare several candidate baskets rather than tune one, it helps to define each as a fixed, weighted set of tickers you can track as a single line, the way you would bundle a set of holdings into your own weighted index, so the backtests stay honest instead of quietly turning into a search for the prettiest curve.
The mistakes that make portfolio backtests lie
- Survivorship bias in the ticker list. Building a portfolio out of stocks that exist today, and testing it back 20 years, guarantees you selected companies that did not go bankrupt. The 2005 version of you did not have that list.
- Rebalancing on data you would not have had. Rebalancing on December 31 using the full year's returns to pick weights is look-ahead bias. The rule has to use only what was knowable on the day it traded.
- Testing many allocations, reporting one. Try 40 weightings and one will look excellent by chance. If you searched, say you searched, and treat the winner with suspicion rather than pride.
- Ignoring taxes in a taxable account. Rebalancing realizes gains. In a taxable account, a quarterly schedule can hand a meaningful slice of the return to the IRS every year, which no backtest shows unless you make it.
Backtest a portfolio without the spreadsheet weekend
Done by hand, this is a data download, a formula sheet, and an evening gone, and every one of those steps is a place to introduce an error you will never notice. That is the work portfolio backtesting on Agenttrading compresses: describe the mix in plain English, such as "60% SPY, 30% QQQ, 10% GLD, rebalanced annually", and the bench restates it as an explicit allocation card before running anything, so you can see exactly what it understood.
It then tests the mix on 20+ years of split- and dividend-adjusted daily data with dividends reinvested and a 0.1% cost per trade charged on every rebalance, plots it against buy-and-hold, shades the worst drawdown with its recovery time, prints every assumption on the result, and stamps an honest verdict: HELD UP, MIXED, or UNDERPERFORMED. The last verdict is kept as prominent as the first, because a bench that cannot tell you your clever allocation trailed a plain index fund is not analysis.
The same discipline applies to single rules on the backtesting software page, the data itself is described under historical stock data, and the drawdown read that follows every run is covered in investment risk analysis. If you are coming from a configuration form, the Portfolio Visualizer alternative comparison is the honest read, and the underlying method for a single idea is in how to backtest a trading strategy.
Agenttrading executes no trades and connects to no brokerage. It shows you what the record says about your allocation. What you do with that is your call.
Past performance does not guarantee future results. For educational and informational purposes only. Not financial advice. Consult a licensed advisor.
Put it on the bench
Ideas are cheap. Verdicts take a bench.
Agenttrading restates your idea as a testable rule, backtests it on 20+ years of adjusted daily data, and explains the risks in plain English. Honest verdicts, even when the idea loses.
Past performance does not guarantee future results. For educational and informational purposes only. Not financial advice. Consult a licensed advisor.