Appearance

Personalize your experience

Mode
Accent Color
Direction
Backtesting Methodology

Backtesting Methodology

Backtesting

What a backtest is actually evidence of, the assumptions built into it, how much data is enough, and the procedure that makes a result worth acting on.

What a backtest can and cannot tell you

A backtest answers one narrow question: had these exact rules been applied to this exact history, under these assumptions about cost and , what would have happened? That is genuinely useful. It is also considerably less than most people read into it.

It can rule things out

A that loses money over three years of history is unlikely to be saved by a better market. Elimination is what backtesting is best at.

It can size risk

The tells you what to expect and whether you could hold it. This is arguably its most valuable output.

It can find bugs

A result that is impossibly good or that 4,000 times is a bug report. Most early backtests are sessions.

It cannot predict returns

The historical return is one sample from a you cannot observe. Treat it as an , not a .

It cannot validate what it tuned

Any parameter chosen by looking at the result is fitted to that result. Only untouched validates.

It cannot model your psychology

A 30% on a chart is a number. Lived through with real capital it is the reason most strategies get abandoned at the bottom.

The assumptions built in

Every simplifies. Knowing exactly where is what lets you discount a result by the amount rather than trusting or dismissing it wholesale.

AssumptionTypeDescription
Bar-close evaluationstructuralConditions are evaluated once per bar, at its close. Intra-bar movement is invisible, so a stop and a target both touched within one bar cannot be ordered.
Complete fillsoptimisticEvery order entirely at one price. Real limit orders in a thin book fill partially or not at all.
No market impactoptimisticYour order does not move the price. True at retail size on liquid instruments, false on illiquid ones and false at scale.
No queue positionoptimisticA at the is assumed if price reaches it. In reality you are behind everyone who was there first.
Perfect dataoptimisticNo gaps, no bad ticks, no feed outages. has all three, and a missing bar changes which signals fire.
Zero latencyoptimisticThe order is placed the instant the bar closes. there is network and broker delay between the two.
!
Caution: that every simplification the same way: they all flatter the result. There is no assumption in the list that makes a backtest look worse than reality, which is why a backtest should be read as a ceiling rather than an estimate.
ONE BAR, AND THE PATH THE BACKTEST CANNOT SEEhigh 103.2open 102.1close 99.4low 97.6same OHLCboth paths produce this identical candlea stop at 98 and a target at 103 are both touched — which one filled first is unknowable from the bar
Two completely different intra-bar paths producing an identical candle. A stop at 98 and a target at 103 are both touched, and nothing in the bar says which came first.
ℹ
Note:This is why a whose stop and target are both inside typical bar range is not really testable on that timeframe. If both levels are routinely touched in one bar, the backtest is choosing between them by convention rather than by evidence — and the convention is usually the conservative one, but it is still a guess.

How much data is enough

Two separate requirements, and satisfying one does not satisfy the other: enough for the to mean anything, and enough variety for the to have met more than one kind of market.

MEASURED WIN RATE 55% — HOW WIDE THE UNCERTAINTY IS55%10 tradesmeaningless30 tradesminimum100 tradesusable500 tradesconfidentat 10 trades the interval spans everything from a losing strategy to an excellent onethe point estimate is the same in every row; only the confidence differs
The measured win rate is 55% in every row. Only the confidence differs, and at 10 trades it spans everything from failure to excellence.
Trade countTypeDescription
Under 30unusableNo metric on the page is meaningful. A 70% over 10 is entirely consistent with a that has no edge.
30 – 100indicativeEnough to reject an obviously bad . Not enough to distinguish a good one from a lucky one.
100 – 500usableThe where start to carry weight and walk-forward comparisons become informative.
Over 500confidentStatistically comfortable — provided the are not all from one regime.

Variety matters independently. Five hundred taken entirely within one sustained bull market is a sample of a single regime, and it tells you nothing about the range or the crash the has never seen.

TimeframeTypeDescription
1m – 5m3–6 monthsProduces quickly. Watch volume and be sure costs are realistic, because frequency amplifies them.
15m – 1H1–2 yearsThe usual sweet spot: enough and enough regime variety in a manageable range.
4H – 1D3–5 yearsNeeded to accumulate a usable sample, which means deliberately spanning different market conditions.
1W10+ yearsA decade may still produce under 100 . Judge these on thesis rather than on .

The procedure

Order matters here. Each step is designed to fail cheaply before the next one costs more, and skipping ahead is how a broken reaches real capital.

  1. 1
    Write the thesis down first
    One sentence on why this should work, before you look at any result. It is the only defence against rationalising whatever the happens to show.
  2. 2
    Set realistic costs immediately
    Commission and slippage before the first run, not after. A that only works at zero cost should be discarded early, not tuned first.
  3. 3
    Run a short range to debug
    One month. You are checking that happen at all and in plausible places, not measuring performance.
  4. 4
    Inspect the trade log
    Read twenty individually. Entry timing, exit reasons, durations. This catches more than any metric.
  5. 5
    Run the full in-sample range
    Now . Trade count first, then , then , then return.
  6. 6
    Walk forward
    Validate on the tuning never touched. This is the step that separates an edge from a memorised history.
  7. 7
    Stress the assumptions
    Double the slippage. Shift the by two months. Drop the best trade. A robust survives all three; a fitted one does not.
  8. 8
    Paper trade
    One to two weeks minimum, for the failures a replay structurally cannot produce.
★
Pro tip: is the one people skip and the one that matters most. A written thesis makes the falsifiable — you can state in advance what result would make you abandon it. Without one, every disappointing result becomes an invitation to adjust a parameter, and that process has only one destination.

Stress tests worth running

Data quality

A backtest is only as good as the series under it, and problems produce that look like results.

  • Missing bars. A gap in the series shifts every subsequent index. A that should have fired on the missing bar fires on the next one, or not at all.
  • Bad ticks. A single erroneous print becomes a spike, and a spike triggers stops, breakouts and volatility filters. One bad can create a trade that never existed.
  • Unadjusted prices. A split or dividend that is not adjusted for looks like a genuine gap. Any reacting to gaps will react to a corporate action.
  • Contract rolls. series stitched across expiries contain a discontinuity at each that is an artefact rather than a price move.
  • Survivorship. An list drawn from what exists today excludes everything that failed, so the sample is the survivors by construction.
★
Pro tip: the and look for a step. A near- jump in a single bar is almost always a artefact rather than a trade, and it is far easier to spot on the chart than in the trade .

Before trusting a result

  • A written thesis that existed before the first result
  • Commission and slippage set to values your broker would recognise
  • More than 30 , ideally more than 100
  • The spans more than one market regime
  • Twenty individual read in the log, not just the summary
  • Exit-reason inspected
  • The best trade removed, and the still works
  • Parameters rounded, and the still works
  • The date shifted, and the result holds
  • Slippage doubled, and the is still profitable
  • Walk-forward validation consistent with the result
  • checked for steps that indicate artefacts

See also

Related articles

  • Backtesting in Python and C++

    Backtesting / SDKs

    The quatick Python package and the header-only C++ library let you import indicators, backtest on your own machine and send the same file to Quatick.…

  • C++ SDK Reference

    Backtesting / SDKs / C++

    Header-only C++20 (packages/quatick-backtest-cpp): the position simulator, an event-driven engine with the same order rules as Python, analytics, a parallel…

  • Execution Modelling

    Backtesting / Execution Modelling

    Commission, slippage, spread and fill assumptions — the difference between a backtest that means something and one that flatters. Costs are where most…

  • From Backtest to Live

    Backtesting / Going Live

    The staged path from a validated backtest to full size, what each stage can detect that the previous one cannot, and the monitoring that tells you when to stop.

  • Monte Carlo and Robustness

    Backtesting / Monte Carlo

    A backtest is one path through history. Monte Carlo asks how different the result could have been with the same edge: a different order of trades, a…

  • Orders and Fills

    Backtesting / SDKs / Orders and Fills

    The event-driven engines of the Python and C++ SDKs share one set of order types and fill rules, so the same strategy fills identically in both languages…

  • Overfitting & Validation

    Backtesting / Validation

    Why searching for a good backtest reliably produces one even when no edge exists, how to recognise a fitted strategy, and the validation designs that…

  • Parameter Optimization

    Backtesting / Optimization

    A sweep backtests every combination of a parameter grid on the same data and costs and ranks them. Used well it shows how sensitive a strategy is to its…

  • Performance Metrics

    Backtesting / Metrics

    What each figure on the results page is computed from, what it hides, and the order to read them in so the important ones are not drowned out by the return.

Browse all knowledge base articles →