Step 1 — Define the rules precisely before looking at data. Write down your entry criteria, exit criteria (both profit target and stop loss), position sizing rules, and any filters (time of day, market condition, volatility threshold). Vague rules cannot be backtested reliably. 'Buy when RSI is oversold' is not a rule. 'Buy at the next bar open when the 14-period RSI closes below 30 on a 15-minute chart, with a stop 1 ATR below the entry bar low and a target 2 ATR above entry' is a rule.
Step 2 — Split your data into training and test sets. This is the most commonly skipped step and the most important. Use 60-70% of your available historical data to develop and tune your rules. Reserve the remaining 30-40% as an out-of-sample test set that you do not touch during development. Only run your final rules against the test set once. If you evaluate your rules against the full dataset, you will inevitably overfit — you will find rules that work on that specific data, not rules that capture a persistent edge.
Step 3 — Include all execution costs. Your backtest must account for commissions, spread (the difference between bid and ask), and slippage (the difference between the price you expected to fill at and the price you actually filled at). For high-frequency strategies, slippage alone can eliminate a marginally positive backtest. Use conservative estimates — assume fills at worse than the mid-price, especially for limit orders in illiquid markets.
Step 4 — Run on out-of-sample data. Once your rules are finalized, run them against the test set you held back. If performance degrades dramatically on the test set compared to the training set, the strategy is likely overfit. A robust edge should hold reasonably well on both sets.
Step 5 — Forward test before risking real capital. Paper trade or trade minimum size for 50-100 trades before committing full capital. A live forward test validates that you can actually execute the rules in real-time — something no backtest can confirm.