Risk Management

How To Backtest A Trading Strategy Without Fooling Yourself

A backtest runs your trading rules on historical data to see how they would have performed. It is the most useful tool a systematic trader has, and also the easiest one to misuse. With enough tweaking, almost any idea can be made to look profitable on past data. The checks below help you avoid that trap.

1. Include Every Cost

Brokerage, STT, exchange charges, GST, stamp duty and slippage all reduce returns. For an intraday strategy that trades often, costs can turn a profitable looking backtest into a losing one. Add realistic costs per trade before you look at any result.

2. Keep Some Data Aside

Split your data into two parts. Build and adjust the strategy on the first part (in sample). Then run it once, without changes, on the second part (out of sample). If performance falls apart on data the strategy has never seen, the rules were fitted to noise rather than a real pattern.

3. Count The Trades

A strategy with 15 trades in five years does not tell you much, no matter how good the numbers look. Aim for enough trades that a few lucky ones cannot explain the result. As a rough guide, look for at least 100 trades across different market conditions.

4. Look At Drawdown, Not Only Profit

Maximum drawdown is the largest fall from a peak in your equity curve. Ask yourself honestly whether you would keep running the strategy through that fall with real money. Also look at the longest losing streak and the longest time the strategy took to reach a new high.

5. Change The Settings Slightly

If a moving average strategy works with a 20 period average but fails with 18 or 22, it is fragile. Robust strategies keep working, perhaps a little worse, when you move the parameters a small amount in either direction.

6. Paper Trade Before Going Live

Run the strategy on a paper or demo account for a few weeks. This shows problems a backtest cannot: delayed data, rejected orders, partial fills and mistakes in how the code handles the market open and close.

A Simple Checklist

  • Costs and slippage included
  • Tested on out of sample data
  • Enough trades to be meaningful
  • Drawdown you can live with
  • Stable when parameters change slightly
  • Paper traded with real time data

Past or backtested performance never guarantees future results, but a strategy that passes these checks has earned a careful, small live test. We follow this process in our courses and in every development project.

Please note: This article is for education only and is not investment advice. Trading involves risk of loss.
Keep Reading

Related Articles