Testing a set of trading rules on historical data to see how it would have performed.
A backtest turns an idea into numbers: win-rate, expectancy, max-drawdown, profit-factor. Done honestly, it kills bad ideas cheaply. Done badly, it produces beautiful curves that fail live.
The usual sins are curve fitting (tuning parameters until the past looks perfect), ignoring slippage and commissions, using data that was not available at the time, and survivorship-bias in the stock universe.
Example: a strategy backtests at +0.5R per trade. Adding realistic 0.1R of slippage and commissions per trade cuts it to +0.4R. Adding the stocks that were delisted during the period cuts it to +0.2R.
Original diagrams for the ideas on this page. Illustrative, not real market data.
Expectancy: the average trade. Forty trades sorted by outcome: 24 small losses and 16 larger wins. Weighting each side by how often it happens gives the average result per trade, marked here by the dashed line at +$120.Slippage on a market order. You click at 20.00, but only 300 shares are resting there, so the rest of the order fills at 20.01, 20.03 and 20.04. The average price paid is 20.02, and that two-cent gap is slippage.
Educational only, not advice. Spotted an error? Post in Site Feedback.