LEARN · EN · easyquanttrading.com
What is backtesting?
Backtesting means taking a defined set of rules, replaying them bar by bar over historical data, and recording what those rules would have done. It is the cheapest way to reject a bad idea. It is not proof that an idea works: a backtest describes the past, and the past is the only period where the answer was already known.
- A backtest is a replay of fixed rules over known history, nothing more
- It is far better at rejecting ideas than at confirming them
- Every extra variation you try raises the chance of a flattering accident
- A held-out period is the minimum honest test, not an optional extra
- Repeated train-and-test windows are stronger evidence than a single split
- Recorded trial counts are what make an overfitting correction computable rather than a guess
- Costs, spreads and slippage belong inside the test, not in a footnote
What a backtest actually does
A backtest engine walks through historical bars in order. At each bar it evaluates your rules using only the information that existed at that moment, decides whether the position should change, and records the outcome. At the end you have a record of simulated decisions. That is the whole mechanism. Everything a backtest can tell you comes from that record, and everything it cannot tell you comes from the fact that the data is already in the past.
The single most common way to get this wrong is look-ahead: accidentally letting a decision use information that would not have been available yet. A normalisation step computed over the whole series, a high or low that includes the current bar, a resampled indicator that peeks forward, or a survivorship-filtered list of instruments are all ways for future knowledge to leak into a past decision. A backtest with look-ahead is not optimistic, it is fictional.
Why a good-looking backtest is weak evidence
- You chose the rules after seeing the data. Even with honest intentions, the idea usually arrives because something in the history suggested it.
- You tried more than one version. Ten variations produce ten results, and the best of ten is not the same claim as the best of one.
- The market regime in your sample may not repeat. A rule tuned to one period of low volatility can look durable and behave differently when conditions change.
- Costs were assumed rather than modelled. Spread, commission, slippage and financing decide whether a high-frequency rule survives contact with execution.
- The sample is short relative to the number of decisions. Twenty trades can look convincing and still be indistinguishable from luck.
The checks that turn a replay into evidence
Each of the following addresses a specific way a backtest misleads. None of them is sufficient alone, and each one can be reported separately so you can see which claims rest on which test.
- Out-of-sample: hold back a period, develop on the rest, then test once on the held-back data. The result is more honest because the rules never saw it.
- Walk-forward: repeatedly develop on one window and test on the next, rolling forward. A chain of consistent out-of-sample segments is much harder to fake than one curve.
- Monte Carlo resampling: shuffle or resample the sequence of outcomes to see whether the result depends on a lucky ordering of events.
- Trial counting and selection-bias correction: record how many candidates were searched, then adjust the significance of the winner for that search. Without a trial count this correction cannot be computed at all.
- Cost re-testing: re-run the surviving candidates with wider spreads and realistic slippage, then see which ones still hold up.
- Parameter sensitivity: perturb the parameters slightly. A result that collapses under a small change is usually fitting noise rather than structure.
What backtesting is not
A backtest is not a forecast, and it is not a promise. It cannot tell you what will happen next, because it only knows what already happened. What it can do is eliminate ideas cheaply and show you the conditions under which an idea stopped working. That is a genuinely useful function: the point of a test is to let you discard things before they cost you anything.
This is also why a high failure rate inside a search process is normal rather than alarming. If you generate many candidate structures and most of them do not survive validation, the process is doing its job. The number worth paying attention to is not how many candidates you produced, but how much of that list remained genuinely independent after screening.
FAQ
- Is backtesting the same as paper trading?
- No. A backtest replays rules over historical data. Paper trading runs the rules forward in real time against live prices without committing capital. Paper trading removes look-ahead risk by construction, but it is slow and the sample accumulates over months. They answer different questions and are usually used together.
- How much history do I need?
- Enough that the number of independent decisions is large relative to the number of parameters you are fitting. A useful sanity check is to compare the count of trades with the count of tuned parameters. If they are the same order of magnitude, the fit is likely to be fragile regardless of how good the curve looks.
- Why did my backtest look good and then fail live?
- The usual causes are look-ahead in the original test, selection bias from trying many variations, costs that were assumed rather than modelled, or a change in market conditions between the sample and live trading. Each of these is testable, which is why the checks above are run separately rather than collapsed into a single score.
- Does a higher number of trades make a backtest more reliable?
- Not by itself. Many trades reduce the sampling error of the result, but they also increase exposure to costs and to the possibility that the rule is simply always in the market. A rule that fires on almost every bar carries very little timing information, which is why signal health is checked before anything else.
- Can software tell me whether a strategy will work?
- No, and no software can. Software can apply validation operations that expose specific failure modes and show you the results in a form you can inspect. What you conclude from them is your judgement, not a recommendation from us.
More guides
Not investment advice. Historical results do not guarantee future performance. EasyQuant is a research factory — you execute on accounts you control.