A backtest fits in one sentence.
Apply your trading rules to the entire history of past data, and count what would have happened if you had taken every single trade the rules called for.
The key part is at the end: "every single trade." Not the handful that worked — every case the rules catch.
And the real purpose of a backtest is a little different from what most people hope. It's less a tool for finding strategies that make money, and more a tool for filtering out strategies that lose money — before you fund them.
Why a backtest, not your eyes
In the last post, I took a chart pattern that looked perfect, turned it into rules, and tested all 837 instances. The result: a profit factor of 1.03 — essentially break-even. And it had looked flawless.
Your eyes go straight to the cases that soared; the hundreds that showed the same shape and fell have already left your field of view. So instead of asking your eyes "does it look right?", you ask a machine "what happens when you count them all?" That's a backtest.
A backtest runs in four steps
Step 1 — Turn the feeling into rules. "Buy when it dips and bounces" can't be backtested. "Buy when the Bollinger Bands contract and price breaks the upper band" can — a computer must be able to answer yes or no.
Step 2 — Take every trade. Trade every case the rules catch. The moment you pick the pretty ones, it's not a backtest anymore; it's collecting self-confirmation.
Step 3 — Subtract costs. Commissions, taxes, and slippage (the gap between your order price and the actual fill). This is bigger than it looks. In the last post's measurements, the same strategy broke even on daily bars but lost 30% a year on 5-minute bars — round-trip costs (measured at roughly 0.23% plus slippage) eat the profits as trading gets more frequent.
Step 4 — Read the report card. Not just the return — win rate, profit factor, and MDD together.
Three numbers on the report card
- Win rate — the share of trades you won. Higher isn't automatically better: a strategy that wins small a hundred times and loses big once can melt an account with a high win rate.
- Profit factor — money won divided by money lost. 1.0 is break-even; below 1.0 you're losing even if you win more often than not. Check this before the win rate.
- MDD (maximum drawdown) — how far the account fell from its peak, at worst. Same return with a -50% drawdown means most people bail in the middle. It answers: "is this a size I can sit through?"
The biggest trap — overfitting
Backtesting has one fatal trap: overfitting — tightening your conditions until the past looks great.
Every condition you add almost always improves the past results. The past is already fixed, so with enough conditions you can fit any data perfectly. The problem is that such a strategy hasn't learned the market's rules — it has memorized the past. And a memorized exam never repeats.
Signs to watch for:
- The number of conditions keeps growing (5, 7, 10…)
- Remove one condition and the results collapse
- It works suspiciously well only in one specific period
The fix points in one direction: separate the data you build on from the data you test on. Split the period in half — build the rules on the first half, test on the second (the basic idea behind walk-forward testing) — or nudge the parameter values and check the results barely move (robustness). A strategy that crumbles at the slightest touch is a strategy that memorized the past.
The other traps
- Survivorship bias — only the winners are visible. Test only on stocks still listed today and every delisted failure silently drops out. (That was the last post.)
- Ignoring costs — skip commissions and slippage and a frequent-trading strategy's results can flip entirely.
- Too few samples — a few dozen trades is more likely luck than skill.
In short
- Backtest = rules → every trade → costs → report card (win rate · profit factor · MDD)
- The purpose is less finding winners than filtering out losers before you fund them
- The more perfect the past looks, the more you doubt it — separate build data from test data
- Passing a backtest guarantees nothing about the future. But the strategies it rejects usually deserved to be rejected
Disclaimer
This article is for informational purposes only and is not investment advice. It is not a recommendation to buy or sell any security. All investment decisions are your own responsibility.
Comments 0
Be the first to comment.