Backtesting Explained

What backtesting actually proves, what it can't prove, and the small set of habits that separate trustworthy backtests from misleading ones.

Updated 2026-05-24
14 min read
beginner

TL;DR. A backtest is a controlled re-play of your strategy against historical data. It cannot prove a strategy will work in the future. It can absolutely prove it would have failed in the past — which is the only filter you can actually run before risking capital. The trick is running backtests honestly enough that the past failures show up.

What you'll be able to do

  • Read a backtest result with the skepticism it deserves — knowing what's measured precisely and what's estimated.
  • Recognize the four most common ways backtests overstate live performance and fix each one in your own work.
  • Set up a workflow that catches strategy failures before you commit capital, instead of in the first month live.

Why this matters

Every dollar lost to a strategy that "looked great in backtest" was lost because the backtest answered a different question than the trader thought it did. Three real failure modes you'll see in the wild:

  • A trader optimizes a strategy on 2018–2023 data, gets a 2.4 Sharpe, deploys, and loses 18% in the first six months because they fit to the past instead of finding an edge.
  • A trader uses bar-data backtesting on a fast scalping strategy, sees an equity curve that compounds at 60% a year, deploys, and discovers that every winning trade required getting filled at the exact bar low — which the live market doesn't allow.
  • A trader runs their strategy with $0.00 commission and "instant fills," looks at the results, and notices nothing wrong. The strategy was a 60-cent edge being eaten by a 70-cent friction cost. The backtest never showed the friction.

Each of these is preventable with the same set of habits.

The core idea

A backtest answers exactly one question: "Given this strategy, this historical data, and these execution assumptions, what would the equity curve have looked like?"

That sentence has three load-bearing parts:

  • This strategy. Frozen. No "I would have known to skip that trade." Backtests measure mechanical execution.
  • This historical data. Specific. Symbol, timeframe, date range — all part of the result. A backtest on MES 5m from 2018-01 to 2024-06 says nothing about how the strategy works on NQ 1m in 2025.
  • These execution assumptions. Where most trouble starts. Commission, slippage, fill priority, latency — every one of these is a model of what actually happens at the broker, and every model has error.

Get those three parts right and the backtest is honest. Get any of them wrong and you're auditing a fantasy.

What 'high fidelity' actually means

The technical phrase you'll hear is tick-level replay. It means the simulation processes every print in the historical tape — every change in price and size at the bid and ask — instead of just the open/high/low/close of each bar. This matters because inside a 1-minute bar, the order in which the high and low formed determines whether your stop or your target hit first. Bar-only engines guess. AlgoLift's backtest engine replays the tape exactly, so it knows.

How AlgoLift handles it

Three platform choices made specifically to keep backtests honest:

  • Tick replay by default. No bar interpolation. The tick vs bar data page covers the difference.
  • Configurable fill realism. A Simulate Fills toggle in the backtest engine. Off for fast iteration, on for any test you'd act on. With it on, limit orders only fill once the historical volume after your price level cleared the orders ahead of yours. The order types & fills page covers the rules.
  • Mandatory commission entry. The engine warns when you start a backtest with $0.00 commission, because that's almost always wrong.

The same platform also makes a fourth choice: parallel execution. A 10-year MES 5m test runs in minutes instead of hours, which makes walk-forward optimization — the single most important anti-overfitting tool — fast enough to actually use.

A worked example

A simple EMA cross strategy, run two ways on the same data. The strategy: long when 20-EMA crosses above 50-EMA, exit when it crosses back. MES 5m, 2018-01-01 to 2024-06-30.

Placeholder · Worked Example

EMA cross strategy — fantasy fills vs. realistic fills

Author hint: Run the EMA cross strategy in two configurations: (a) $0 commission, no slippage, instant fills, (b) $0.62 round-trip commission, realistic slippage, Simulate Fills on. Report CAGR, max DD, Sharpe, and trade count for both. The contrast between the two is the entire pedagogical point of this page. Numbers must come from a real backtest run.

What this shows. The two columns are the same strategy on the same data. The only difference is whether the execution model is honest. If you only ever look at the left column, you'd deploy a losing strategy. If you start with the right column, you'd either accept the strategy as a modest edge or reject it as too thin to survive friction.

This is the entire point of professional backtesting: the second column is the answer that matters.

Common misunderstandings

Common Misconception
Myth
A higher backtest Sharpe means a better strategy.
Reality
A higher backtest Sharpe on the *out-of-sample* window — data the strategy was not fit to — means a better strategy. A higher in-sample Sharpe often means a better-fit curve. The split between in-sample and out-of-sample is the single discipline that separates research from self-deception. The [overfitting in trading](/guide/foundations/overfitting-in-trading) page covers how to do the split.
  • "My strategy is profitable in backtest, so I'm ready to go live." Backtest profitability is necessary, not sufficient. The forward testing stage is what catches look-ahead bias and fill-model errors before they cost you real money.
  • "I need 20 years of data to backtest properly." You need enough data to see multiple regimes. For most futures, 5–10 years covers it. For crypto, 3 years is often the maximum that's even available. More data is better at the margin; more data than is needed is just a longer wait.
  • "I can backtest one parameter setting and trust the result." A single backtest of one parameter set is a single data point. A parameter sweep tells you whether the strategy is robust to small changes — and a strategy that's only profitable at exactly Period=14 isn't a strategy, it's a coincidence.

The four habits that fix most bad backtests

  1. Use realistic costs. Your broker's actual commission. The platform's Realistic slippage mode. Both, every time.
  2. Reserve out-of-sample data. Pick a window — say the last 12 months. Don't touch it until you've finished iterating on the in-sample period. Then run exactly the final strategy on the held-out data without changing anything. Whatever number comes out is the closest honest estimate you have of live performance.
  3. Warmup the indicators. A 200-bar moving average needs 200 bars of data before its values are meaningful. The engine handles this automatically, but if you write your own date ranges by hand, remember to start the trading period after the slowest indicator has filled.
  4. Read the worst-10 trades. Five minutes in the Analytics trade list, sorted by worst PnL ascending, catches more bugs than any other audit step. Ask yourself for each: would I actually have held this? If no, the backtest is overstating performance.

When backtests are most useful

  • Comparing two variants of the same strategy on the same data and the same costs. The relative answer is reliable even if the absolute numbers have error bars.
  • Sanity-checking an idea. Backtests are cheap; running an obviously broken idea once and seeing it fail is a faster way to learn than reading about why it would fail.
  • Stress-testing. Running a strategy through every regime in the historical data — 2018 Q4, 2020 COVID, 2022 rate hikes — shows where it breaks. The pages on market regimes and robustness testing cover this in depth.

When backtests matter less

  • For strategies whose edge is mostly execution speed. A backtest can't model your specific co-located setup. These edges live or die on infrastructure, not on logic.
  • For very new instruments. A 6-month BTC-PERP backtest will tell you almost nothing about the next 6 months of BTC-PERP. The data is too thin to be representative.
  • For discretionary strategies dressed in systematic clothing. If the rules require human judgment ("enter when the chart feels bullish"), no backtest can faithfully reproduce them.
Key Takeaway

A backtest is not a prediction of future performance. It is a stress test of past performance under a specific set of execution assumptions. Run it with honest assumptions and reserve out-of-sample data, and it becomes the most valuable filter in your research. Skip those two habits and it becomes the most expensive form of self-deception in this industry.