DEV Community

Cover image for How to Backtest a Trading Strategy Without Lying to Yourself
Emmanuel Dessallien
Emmanuel Dessallien

Posted on • Originally published at compoundpulse.com

How to Backtest a Trading Strategy Without Lying to Yourself

Most backtests look great. That's the problem. They use overfit rules, ignore execution costs, and reward the person who built them instead of the strategy itself.

Why backtest: Validates statistical edge vs bull market luck. Shows behavior across regimes. Reveals worst drawdown. Gives reference point when real trades go against you. Honest caveat: goal isn't a strategy that looks good on paper — it's one that would have been hard to break.

Step 1 — Surgical precision: If you can't explain your entry in one sentence it's not testable. Entry: RSI crosses above 30 while price above 200 EMA. Exit: RSI above 70 OR price drops below 200 EMA. Stop: 2x ATR. Size: 2% risk. Any two people should make identical trades.

Step 2 — Data + regime testing: Min 3-5 years spanning bull and bear. Ideal 10+ years including 2008, 2020, 2022. Critically: segment by regime. A strategy that only works in bull markets is just market beta — you could've bought an index fund.

Step 3 — Run it: CompoundPulse Backtests page — select ticker, timeframe, strategy. No code. Don't adjust parameters based on early results — that's curve fitting.

Step 4 — Metrics + walk-forward: Total return, vs buy & hold (most strategies don't beat it), win rate (40% with 2:1 R/R is profitable), profit factor (>1.5 solid, >2.0 excellent), max drawdown (stress test), Sharpe ratio (>1.0 acceptable, >2.0 strong), number of trades. Then: split into in-sample (optimize) and out-of-sample (holdout). If it only works on data you tuned it for, it found patterns in noise, not signal.

Step 5 — Equity curve: Grows steadily with shallow drawdowns. Red flags: 30%+ drawdowns, long flat periods, only works in bull markets, suspiciously smooth curve (real strategies have rough patches — too smooth = overfitting, not skill).

Common Mistakes (the heart of the article):

Curve fitting: You can make any strategy look great on 5 years of AAPL if you tweak enough parameters. You haven't found an edge — you've memorized the data. Real test: does it work on TSLA? Financials 2018-2022? If it only works when conditions are precisely right, you have a coincidence.
Survivorship bias: Lehman Brothers, Enron, Bed Bath & Beyond aren't in your universe. Biases every result upward. Always in the same direction.
Parameter fragility: Strategy only works with RSI 14 but falls apart at RSI 12 or 16 = fragile. Real edges are robust across parameter ranges. Changing one input by 10% shouldn't destroy results.
Not enough trades: Under 20 is astrology. Need 30-50 minimum. A coin flipped 12 times can "win" 70% without meaning anything.
Slippage: High-frequency strategies on thin stocks look phenomenal and are completely unexecutable. Stock trades 50K shares/day, you need 10K at open — the historical fill price is fiction.
Honest filter: After realistic slippage and commissions, does the strategy still have an edge? If it only works in a frictionless world, it doesn't work.

3 Questions before trusting any backtest:

Does it work on out-of-sample data? (Performance collapses = overfitting found)
Does it work across different assets and sectors? (Robust edges generalize, coincidences don't)
Does it still work if I change parameters slightly? (RSI nudged by 2, MA shifted by 10 days — still consistent = maybe real; falls apart = fragile artifact)
After all 3 pass → paper trade in real time with simulated money before risking capital. CompoundPulse has both built-in — no switching platforms, no code.

If you want to run this workflow without stitching tools together, try CompoundPulse — backtesting, charting, and screening in one place. compoundpulse.com

Top comments (0)