Skip to main content
Menu

⚠️ Risk Warning: Trading forex, CFDs, and cryptocurrencies involves substantial risk of loss and may not be suitable for all investors. This platform provides educational content only and does not constitute financial advice.

⚡ Level 4 · Advanced Tools, Data & Automation Automation

Strategy Backtesting

Strategy backtesting applies trading rules to historical data to estimate how a process might have behaved. Its purpose is to falsify assumptions and understand distributions, not to ma

Progress 0%

Reading progress — saved on this device

TOOLS, DATA & AUTOMATION · AUTOMATION
Risk-first note. Look-ahead bias, survivorship bias, overfitting and unrealistic fills can make a worthless strategy appear excellent. The more parameters and variants tested, the stronger the evidence needed before trusting the best result.

Learning objectives

  • Build tests that use only information available at each historical decision point.
  • Model fees, funding, spread, slippage and liquidity realistically.
  • Separate in-sample development from out-of-sample and robustness testing.

What it is and why it matters

A backtest needs data, signal rules, portfolio logic and an execution model. Every timestamp must respect causality: if a signal uses a candle close, the fill cannot occur earlier than that information becomes known.

Universe construction is a major source of bias. Testing today’s surviving tokens through past years omits delisted failures. Historical constituent sets and listing dates should be respected.

Execution assumptions should scale with strategy turnover and asset liquidity. A mid-price fill with no fees can be acceptable for a rough low-turnover prototype but is misleading for high-frequency or small-cap strategies.

Parameter search creates multiple-testing risk. If hundreds of lookbacks are tested, the best result can arise from chance. Robust strategies should work across reasonable parameter neighbourhoods and independent periods or markets.

Operational framework

CheckPurposeWhat to verify
CausalityPrevents look-aheadUse only data known before the simulated decision.
UniversePrevents survivorship biasInclude historical listings/delistings and eligibility rules.
CostsTests tradabilityModel spread, fees, funding, borrow and size-dependent slippage.
ValidationTests generalisationReserve out-of-sample periods and stress nearby parameters.

Evidence, data quality and limitations

Data cleaning can accidentally leak future information. Backfilled token supply, corrected timestamps or today’s exchange classifications may not have been known historically. Store as-of data where possible.

Backtests should report distributions, not only CAGR. Drawdown, turnover, hit rate, average win/loss, tail loss, exposure and capacity help determine whether the apparent edge is economically usable.

Worked example and thought exercise

A daily strategy buys at the closing price whenever that same close crosses above a moving average. If the test also fills at that close, it assumes the trader knew the final closing value before the close occurred. Filling at the next available price avoids this look-ahead.

A strategy earns 18% gross with 12% annualised trading costs and 3% funding drag. Net return is roughly 3% before taxes and other frictions; gross results were a poor guide to economic value.

Thought exercise: Why does testing many parameter combinations make the best historical result less trustworthy?

Common mistakes and practical workflow

  • Filling at prices that were not knowable when the signal formed.
  • Testing only tokens that still exist today.
  • Ignoring fees, funding and slippage.
  • Selecting the single best parameter set and calling it robust.

Practical workflow

  1. Specify rules and data fields before looking at results.
  2. Enforce point-in-time universe and information availability.
  3. Implement conservative execution and cost assumptions.
  4. Develop on one sample, validate on untouched periods or markets.
  5. Stress parameters, costs, delays and liquidity before considering live deployment.

Knowledge checkpoint

  1. What is look-ahead bias?
  2. How does survivorship bias affect crypto backtests?
  3. Why is parameter robustness important?
  4. Which costs should a derivatives backtest include?

FAQs

❓ Does a profitable backtest prove an edge?

No. It is evidence under assumptions that must survive validation and live frictions.

❓ What is out-of-sample testing?

Evaluation on data not used to choose or tune the strategy.

❓ Why model slippage?

Real orders consume liquidity and may fill away from reference prices, especially at larger size.

❓ What is overfitting?

Adapting rules too closely to historical noise so performance fails to generalise.

Summary

Backtesting is a controlled historical experiment. Causal timing, point-in-time universes, realistic costs and genuine out-of-sample validation matter far more than the smoothness of the final equity curve.

BUILD YOUR OWN PATH

Want this in a personalised order?

Take the crypto assessment and get a custom path of 10 modules matched to what you already know. Free, no card required.

Build my path →