Backtesting — Proving an Idea Before Risking Real Money

A backtest runs a strategy's rules against historical data to see how it would have performed. Done properly, it's the difference between a hunch and evidence — done carelessly, it's a very convincing way to fool yourself.

The Concept

From Idea to Evidence

A backtest takes a strategy's rules — precisely defined, no ambiguity — and simulates applying them to historical data, to see what would have happened. It answers a specific question: "if I had followed this exact rule in the past, what result would it have produced?" That's a narrower claim than "this strategy will work," but it's a necessary first filter before risking any real capital.

The value of a backtest depends entirely on how honestly it's built. Two failure modes dominate: lookahead bias (accidentally using information that wouldn't have been available at the time — like a full year's earnings data applied to a trade made mid-year) and overfitting (tuning the rules so precisely to the historical data that the strategy has essentially memorized the past rather than found a real, repeatable pattern).

A realistic backtest also has to account for costs that are easy to ignore on paper: trading commissions, the bid-ask spread, and slippage (the difference between the price you wanted and the price you actually got, especially in a fast-moving or illiquid market). A strategy that looks great with zero costs can turn unprofitable once realistic frictions are added — which is exactly why this step exists.

⚖️ Illustrative Example: The Same Backtest, With and Without Realistic Costs

A hypothetical strategy trades frequently. Here's how its results change once trading costs and slippage are added — illustrative numbers only.

VersionTrades / YearGross Annual ReturnEst. Cost DragNet Annual Return
No Costs Assumed240+18.0%0.0%+18.0%
Realistic Costs Assumed240+18.0%-11.5%+6.5%

240 trades a year at even a small per-trade cost (commission + spread + slippage) compounds into a large annual drag — the "no costs" version looks like a great strategy, the realistic version looks merely decent. Always ask which one you're looking at.

Watch For This

5 Things to Know About Backtesting

  1. A great backtest is necessary, not sufficient — it filters out obviously bad ideas, but a good result doesn't guarantee future performance.
  2. Overfitting gets worse the more you tune — the more parameters adjusted to fit historical data, the more likely the result is fitting noise, not signal.
  3. Out-of-sample testing is the standard defense — building rules on one period of data and testing them, unchanged, on a separate period the rules never saw.
  4. Survivorship bias can silently inflate results — testing only on companies that still exist today ignores the ones that went bankrupt or were delisted along the way.
  5. A backtest is a simulation, not a guarantee — market conditions, liquidity, and competition all change, and history never repeats exactly.
Put It Into Practice

4 Things to Check in Any Backtest

🕰️ Check for Lookahead Bias

  • Confirm every input used in a trade decision would genuinely have been known at that exact point in time.

💸 Include Realistic Costs

  • Model commissions, spread, and slippage — especially for strategies that trade frequently.

🧪 Hold Out a True Test Period

  • Never tune parameters on the same data you're using to judge the final result.

📉 Stress-Test Across Regimes

  • Check performance separately across calm, trending, and volatile periods, not just one smooth overall number.
🧮 Related tool: GCG's own Backtester tool lets you run a strategy's rules against historical data directly — a hands-on way to apply everything in this lesson. Regime Detection (next in this track) covers the stress-testing idea above in more depth.
Worth knowing: this lesson explains backtesting methodology using illustrative numbers and historical framing — it isn't personalized financial advice, and no strategy or backtest result described here is a recommendation to trade. Past backtested performance, however carefully built, is never a guarantee of future results. Speak to a licensed advisor about what's appropriate for your situation.
Activity

Try It Yourself: Cost Drag Calculator

Enter a gross backtest return, trade frequency, and a per-trade cost estimate — see how much realistic costs eat into the headline number.

Est. Annual Cost Drag
Net Annual Return
Annual Cost in $

Model: cost drag = trades per year × cost per trade (%). Net return = gross return − cost drag. Illustrative only — actual costs depend on the specific broker, asset, and market conditions.

End of Lesson

Quick Check: 5 Questions

Answer all five, then hit "Check My Answers" to see how you did. Get one wrong? No problem — the explanation will show you exactly why.

0/5
Nice work — review any explanations below to lock it in.
1. What does a backtest do?
A backtest answers "if I had followed this exact rule in the past, what would have happened?" — a narrower, evidence-based question, not a guarantee.
2. What is lookahead bias?
Lookahead bias means the backtest used data (like full-year earnings) before it would genuinely have been known, inflating the apparent result.
3. In the illustrative example, why did realistic costs matter so much for the frequent-trading strategy?
A high trade count multiplies even small per-trade frictions into a substantial annual cost, turning an 18% gross return into a 6.5% net return in the example.
4. What is the standard defense against overfitting described in this lesson?
Out-of-sample testing checks whether rules built on one period of data still hold up on a separate period they never influenced.
5. What is survivorship bias in this context?
Survivorship bias inflates results by silently excluding the companies that failed along the way, since they're no longer in today's easily-available datasets.
Downloads

Take This Lesson Offline

Print-friendly resources to revisit, practice, and dig deeper — no login required.

Next Up: Regime Detection

A backtest tells you how a strategy performed on average across history. The next lesson covers how to recognize when market conditions themselves have shifted, so you know when that average may no longer apply.