A backtest replays your rules on past data, candle by candle, as if you were trading live. Everything is done by hand: the replay mode of a charting platform (it hides the rest of the chart) and a spreadsheet are enough.
Method: write precise rules (entry, stop, target, exit time), load intraday data (5-minute candles), step forward candle by candle without looking ahead and log each trade in the spreadsheet. Any position still open at 5:25 pm is closed at that price.
In the spreadsheet, subtract commissions and slippage from each trade: many intraday strategies that win on paper turn into losers once costs are included. Aim for at least 50 to 100 trades so the numbers mean something.
A good result must hold out of sample, on a period not used to tune the rules, then in paper trading (simulated trading in real time, with no money) before any real money.
Examples
TEST-X (fictional market) : On TEST-X, the trailing stop follows the rise and then closes the position. In a day trading backtest, you also check that no position survives the end of the session: every trade must be closed before the close.
6 May 2010: the “flash crash” : In the middle of the session, the Dow Jones loses nearly 1,000 points, about 9%, in a few minutes, then recovers most of it within half an hour. Some shares briefly trade at $0.01, stops are filled at absurd prices, and some trades are later cancelled. Lesson: a day-trading backtest on “clean” candles does not show such extreme fills; allow for slippage and limit your risk before going live.
Key terms
Backtest
Testing a strategy on past data
Intraday data
Prices split into candles of a few minutes
Out of sample
Period not used to tune the strategy
Overfitting
A strategy fitted too closely to the past, which then fails