What is Backtesting?
Backtesting is a method of using historical market data to verify whether a trading strategy is effective. Simply put, it means running your trading strategy on historical data in a "simulated execution" to see what the results would have been if you had used this strategy in the past.
The value of backtesting: verifying your ideas with data before putting real money on the line. Visit the Strategy Center to see our backtest performance. This avoids the subjective bias of "feeling like this strategy is good."
Basic Steps of Backtesting
Step 1: Define Strategy Rules
Write your trading strategy as clear, executable rules:
- Entry conditions (e.g., price breaks above 50-day high + volume expansion)
- Exit conditions (e.g., falls below 20-day MA or 20% profit)
- Position management (e.g., invest 10% of total capital per trade)
Rules must be clear enough that anyone can execute them.
Step 2: Select Historical Data
- Time range: Recommend at least 5-10 years, covering bull markets, bear markets, and range-bound markets
- Stock universe: Consistent with the market you actually trade
- Data quality: Ensure accurate data, including dividend adjustments
Step 3: Execute Simulated Trading
Simulate each trade on historical data according to strategy rules, recording:
- Entry/exit time, price, and P&L for each trade
- Number of trades, win rate, win/loss ratio
Step 4: Analyze Results
Calculate the following key metrics:
| Metric | Meaning | Ideal Value |
|---|---|---|
| Annualized Return | Average annual return rate | > 10% |
| Maximum Drawdown (MDD) | Historical maximum loss | < 20% |
| Sharpe Ratio | Risk-adjusted return | > 1.0 |
| Win Rate | Percentage of winning trades | 40-60% |
| Win/Loss Ratio | Average profit ÷ Average loss | > 2:1 |
Common Biases
Overfitting
The strategy is overly "tailored" to historical data, performing perfectly in backtests but failing in live trading. Signs: overly complex rules, too many parameters.
Survivorship Bias
Only testing stocks that are still trading today, ignoring companies that have been delisted. This makes backtest results look better than reality.
Look-Ahead Bias
Using information that wasn't available at the time to make decisions. For example, using today's financial report data to judge past buying timing.
Summary
Backtesting is a good tool for validating strategies, but with two key prerequisites:
- Rules must be clear and executable — not vague or subjective
- Beware of overfitting — the simpler the strategy, the more likely it is to work in live trading
For more quantitative content, see the Learning Center introductory courses and the Strategy Center backtest performance.