The basic steps
- Write the entry, exit, sizing and time rules in plain words first.
- Pick the instrument, timeframe and a historical period long enough to include different market conditions.
- Set realistic costs: brokerage, statutory charges and a slippage allowance.
- Run the test and read the full trade list, not just the headline return.
- Change one thing at a time, and note why you changed it.
Costs and slippage
Every real trade pays brokerage and charges, and rarely fills at exactly the price you saw. A strategy that trades often can look profitable before costs and unprofitable after them. If a backtest has no cost settings, treat its result as an upper bound, not an estimate.
Slippage is the gap between the price you expected and the price you got. It is larger in thin markets and fast moves. Even a small percentage added to every fill changes how many trades survive.
Look-ahead bias
Look-ahead bias happens when a test lets the strategy use information that was not yet available. A classic case is entering at the close of a candle on a signal that needed the full candle to form. The result looks wonderful and cannot be repeated. A sound engine only lets a rule act on data that existed at that moment, and waits for indicators to warm up before trusting them.
Overfitting
If you keep adjusting parameters until the backtest is excellent, you are teaching the strategy the past instead of finding a pattern. Signs of overfitting include many finely tuned numbers, results that collapse with a tiny parameter change, and a great period followed by a poor one.
Useful habits are keeping the rule set small, testing across several time periods, checking that nearby parameter values behave similarly, and then watching the strategy on new data in a forward test before trusting it.
Reading the metrics
- Total return and CAGR show growth, but say nothing about the path taken to get there.
- Maximum drawdown is the largest fall from a peak. Ask whether you could actually sit through it.
- Win rate alone is misleading. A strategy can win rarely and still do well, or win often and lose overall.
- Profit factor and expectancy show what each trade earns on average after losses.
- Trade count matters. A handful of trades is an anecdote, not evidence.
What a backtest cannot tell you
A backtest describes how the rules would have performed under the assumptions you set. It cannot tell you how the market will behave next, how your broker will fill a large order, or how you will react to a losing streak. Treat it as a filter for bad ideas, not proof of a good one.