Topic index Back to homepage

[Systematic Trading] What is backtesting (回測)? How to avoid overfitting (過度擬合) and historical traps

30-second key takeaways (Key Takeaways)

1. Basic concepts and importance of backtesting (回測)

When entering systematic and quantitative trading, backtesting is the first step to validate an idea. In short, backtesting simulates a strategy over a historical period using historical prices, volumes and financial data via code or professional software to reproduce hypothetical executions.

The core value of backtesting is to quickly eliminate ineffective trading ideas without risking real capital and to evaluate a strategy's max drawdown (MDD), win rate, profit factor and Sharpe ratio. Good backtest results, however, are no guarantee of future live performance.

2. The biggest fatal backtest trap: overfitting

Many beginners fall into traps when backtestingOverfitting (also called curve fitting)...to the abyss. When you repeatedly add parameters in backtest software (for example, fine‑tuning a moving‑average from 20 days to 23, then adding complex conditions like RSI > 58 and MACD histogram > a specific value) until the backtest curve forms a perfect 45‑degree upward line, your strategy is very likely severely overfitted.

The essence of overfitting is treating random noise in historical data as general rules. When such a strategy — tuned countless times — is deployed in future real markets, changes in the environment typically cause it to fail rapidly and incur large losses.

Backtest characteristics Sound trading strategy An overfitted (curve‑fitted) strategy
Number of parameters Streamlined (typically 1–2 core parameters) complex (several to a dozen+ tuning parameters)
Logical foundation Based on macroeconomics or market microstructure Blindly chasing historically maximized performance
Out‑of‑sample performance stable performance, small backtest gap Catastrophic live failure — results completely non‑replicable.

3. How to prevent overfitting: out‑of‑sample testing and walk‑forward

To ensure backtest results have real‑world value, quantitative traders use a scientific validation process:

1. In-sample vs out-of-sample split (In-sample / Out-of-sample):Split historical data into two parts. For example, use 2010–2020 for strategy development and parameter tuning (in‑sample), then test independently on unseen 2021–2025 data (out‑of‑sample). Only strategies that still perform well out‑of‑sample qualify for live deployment.

2. Walk-forward Analysis (步進式向前分析):Dynamic rolling optimization and validation windows simulate the real‑world process of periodically reviewing and adjusting a strategy.

After building a robust quantitative system, precise money management is key to surviving the market. We recommend pairing with the on‑site Kelly risk budget tool,scientifically manage the capital allocation for each trade entry.

Frequently Asked Questions (FAQ)

What are in‑sample and out‑of‑sample backtests?
In‑Sample data are the historical intervals used for training, parameter tuning and strategy construction; Out‑of‑Sample data are independent time intervals completely held‑out during development. If a strategy performs very well In‑Sample but deteriorates significantly Out‑of‑Sample, it indicates overfitting to historical noise.
What is walk‑forward analysis? Why is it the quant industry standard?
Walk‑Forward analysis simulates real‑world live trading: in a rolling window (e.g., optimize parameters on the prior 2 years), apply the best parameters to the immediately following 6 months for out‑of‑sample testing, then roll the window forward and repeat. It dynamically tests strategy adaptability across market‑regime shifts (e.g., bull to bear) and substantially improves live‑trading survivability。
After going live, at what maximum drawdown threshold should a strategy be force‑stopped?
The industry commonly uses a “max‑drawdown tolerance multiplier” as a circuit‑breaker: when live max drawdown exceeds 1.5× historical backtest MDD, or when consecutive loss count exceeds the Poisson distribution 99% confidence interval, immediate forced shutdown is required. This typically indicates a qualitative change in the underlying market microstructure; continuing to run risks insolvency.

Advantages and target audience

Backtesting replaces subjective emotion with scientific data, helping traders build objective discipline; it is especially suitable for investors pursuing systematic and algorithmic trading.

Challenges and cautions

History won't repeat exactly but it often rhymes. Backtests cannot predict future black‑swan events or liquidity crises; strict stop‑losses are still required in live trading.

Do you like this article?

Your support is my greatest motivation to keep creating high‑quality investment education.

Ko‑fi Buy me a coffee
GugoPro Academy · Interactive lab

Investment decision checklist

Use out‑of‑sample thinking and replay records to reduce overfitting.

Act now tool →

Financial risk disclaimer

This page, its calculators, and examples are for education, research, and scenario estimation only. They are not personalized investment, trading, betting, tax, legal, or financial advice. Markets and local rules can change quickly; verify current primary information and take responsibility for your decisions. Past performance, model outputs, and simulations do not guarantee future results.