How to Backtest a Trading Strategy
A trading strategy backtest applies fixed rules to historical data. A useful backtest lets you reproduce each trade and explain which assumptions drive the result.
Write the test before you run it
Record the universe, dates, bar interval, initial allocation and entry and exit rules. Keep a later date range out of the first round of tuning. If you change the rules after seeing that later range, treat it as part of development and pick a different validation period.
Set execution and costs explicitly
Check when a signal becomes tradable and which price the simulation can use. Account for spread, commission, slippage and funding where applicable. As a simple check, an estimated 0.20% round-trip cost is $2 on $1,000 of notional, even if the price is unchanged.
Review trades as well as the equity curve
Look at total trade count, maximum drawdown, the longest recovery and net results by period. Inspect several losing trades and any unusually large winner. Compare the same metrics on the later range before deciding whether the rule deserves further testing.