Draft

How Backtesting Works

September 14, 20266 min read

What a backtest is, exactly what HalalFolio assumes when it runs one, and why a backtested number rarely matches the planning assumption beside it.

How Backtesting Works

A backtest asks one question: if I had held this exact portfolio through the past, what would have happened to my money?

It is not a forecast. It is arithmetic run over history that already happened. That makes it useful — it is the closest thing to evidence you can get about a mix of funds — and it makes it easy to misread, because a run through one particular slice of the past can look far more (or far less) flattering than what the next decade will actually do.

This page explains exactly what HalalFolio assumes when it runs one, so you can judge the answer instead of just reading it.


What a backtest actually does

Start with a portfolio: a set of ETFs and the percentage of your money in each. Pick a start date and an end date. Then, for every trading day in between:

  1. Take each fund's closing price for that day.
  2. Convert it to Canadian dollars using that day's exchange rate.
  3. Multiply by the number of units the backtested portfolio holds.
  4. Add the holdings together. That is the portfolio's value for the day.

String those daily values together and you have the line you see on screen. The return quoted underneath it is simply the change from the first value to the last, and the "per year" figure is that change spread evenly across the years it covered.


The assumptions, stated plainly

Every backtest makes choices. Here are ours, in full.

It is computed in Canadian dollars

Most halal ETFs available to Canadians are listed and priced in U.S. dollars. Your money is not. So every U.S. price is converted to CAD before anything is added up, using the exchange rate for that same day — not today's rate applied backwards over the whole history.

This matters more than people expect. A fund can have a strong decade in USD and a merely decent one in CAD, or the reverse, purely because of where the loonie went. The number you see is the number a Canadian investor would have lived through, currency swings included.

It uses adjusted closes, with distributions reinvested

Prices are adjusted closes, which means dividends and other distributions are treated as though they were paid out and immediately used to buy more of the same fund. This is the standard "total return" basis, and it is the same basis as the trailing-return tiles on every ETF page.

Without it, any fund that pays you cash would look like it went nowhere. With it, the line reflects what you actually ended up with.

It charges the fund's MER, and nothing else

The only cost deducted is each fund's management expense ratio — the fee the fund company takes, accrued daily across the backtested period.

That is a real cost, and ignoring it would flatter every result. But it is not the only cost you would have paid in real life. A backtest here does not account for:

  • brokerage commissions on each buy or rebalance
  • the bid-ask spread you cross on every trade
  • currency conversion fees your broker charges (separate from the exchange rate itself)
  • withholding tax on foreign distributions
  • any tax you would owe in a non-registered account

It rebalances on a stated rule

Left alone, a portfolio drifts: whatever went up becomes a bigger share of the total. Rebalancing sells a little of the winners and tops up the laggards to get back to your target percentages.

The backtest applies a stated rebalancing rule — the rule is shown with the result, so you always know which one produced the number. Rebalancing is assumed to happen instantly and at closing prices, with no commission, no spread and no tax consequence. Real rebalancing has all three.

It assumes you held on

The backtested investor never sold in a panic, never stopped contributing, never took money out for a car. Every backtest silently assumes perfect discipline through every drop in the period, including the worst one. That assumption is doing quiet, heavy lifting in every attractive result you will ever see.


Reading the models comparison

The models comparison runs several portfolios through the same dates, the same currency basis and the same rebalancing rule, so the lines are genuinely comparable to each other.

What to look at:

  • The shape, not just the endpoint. Two portfolios can finish at the same place having taken completely different routes. The one with the shallower dips is the one you are more likely to actually hold.
  • The worst stretch. Find the biggest peak-to-trough fall on the line and ask honestly whether you would have sat through it.
  • The window. A comparison that starts right after a crash makes everything look brilliant. One that starts right before makes everything look grim. Check the start date before you form a view.
  • Different histories, different lengths. Some halal ETFs are young. If one portfolio's funds only go back a few years, its comparison window is short, and a short window is mostly noise.

Reading the ETF returns strip

On each ETF page, the trailing-returns strip shows seven windows — 1 month through since-inception — on the same basis a backtest uses: total return from adjusted closes, converted to CAD.

Two things to know:

  • 3-year, 5-year and since-inception lead with a per-year figure. "12% per year" over five years is not the same as "12% total"; where both are useful, the cumulative total is shown underneath.
  • "n/a" means the fund is younger than the window, not that the data is broken. The strip says where the history starts.

These are measured numbers for a single fund. A backtest is a replayed number for a combination of funds, held together and rebalanced. Related, but not the same thing.


Why the planning assumption and the backtested number differ

The planning assumption shown beside a fund or a portfolio is a long-run, per-asset-class figure our builder and projections use. A backtested return is a measurement of the past. They are answers to different questions, so they rarely match — and when they do, it is a coincidence, not a confirmation.

They differ for four reasons:

  1. Direction. The planning assumption is a view about what an asset class should reasonably deliver over decades, set conservatively. The backtest reports one particular stretch of history that actually happened.
  2. Window. Any ten-year stretch you can pick includes some booms and some busts, but never in their long-run proportion. Shift the start date by two years and the measured number moves, sometimes by a lot. The planning assumption does not move at all.
  3. Currency. The planning assumption is a view about the asset. The measured number includes whatever the Canadian dollar did over those exact dates, which can add or subtract several points a year.
  4. Costs and mechanics. The measured number carries the MER and the specific rebalancing rule. The planning assumption is a cleaner, pre-mechanics figure.

For how the planning assumptions themselves are set, see The ETFs; for how they are combined across a portfolio, see Portfolio Calculations.


The caveat that never stops applying

Past performance does not predict future results.

That sentence is on every chart because it is true, not because a regulator requires it. A backtest tells you how a combination of funds behaved through a stretch of history — how bumpy it was, how long it took to recover, whether two holdings actually offset each other. It tells you nothing about what happens next.

Use it to understand the character of a portfolio. Do not use it to choose a portfolio because it won the last ten years.

Keep reading