Backtesting means running your strategy on past price data to see if it would have been profitable. The steps: (1) Define your setup rules exactly, (2) Run on 100+ trades of historical data, (3) Calculate expectancy, (4) Check for curve-fitting (your setup only works on that data?), (5) Forward test on new data. Backtesting is the cheapest way to validate a strategy before risking real money.
- Backtesting is mandatory before live trading
- Most traders backtest poorly (cherry-picking data, ignoring commissions, curve-fitting)
- The backtest must survive out-of-sample testing
- Backtesting shows risk, not reward; use position sizing to manage it
Backtesting is how you validate a strategy before risking real money.
The backtesting process
Step 1: Define your setup rules precisely
NOT: "Buy breakouts"
INSTEAD:
- Instrument: SPY
- Timeframe: 15-minute chart
- Setup: Break of 15-min range high from 9:30–10:00 AM
- Entry: At the high, confirmed close above it
- Stop: 1 tick below the range low
- Target: 2× the risk (2R)
- Exit: At target or stop, whichever hits first
- Trade only between 9:30–11:30 AM ET
This is testable. You can code it or backtest manually.
Step 2: Gather historical data
Use a charting platform, a data provider, or a backtesting engine.
Options:
- TradingView: Built-in backtester (limited)
- MetaTrader: Thinkorswim: Manual review (tedious but exact)
- Professional tools: ThinkorSwim, NinjaTrader, Thinkorswim (require learning)
For S&P 500 or SPY, data is free and clean.
Step 3: Run 100+ trades
Manually or with software, run your setup on the past 100 trades.
Record:
- Date, time, instrument, entry, stop, exit, result (R)
- Setup grade (A/B/C)
- Market condition (trending, choppy, gapy)
After 100 trades:
- Calculate: Win rate, avg win, avg loss, expectancy, profit factor, max drawdown
Step 4: Validate the backtest
Red flags (bad data):
- ❌ 80%+ win rate (unrealistic, you've optimized too much)
- ❌ Expectancy >+1R per trade (almost never happens; suspect curve-fitting)
- ❌ Results only work on certain dates (your setup is date-dependent, not setup-dependent)
- ❌ Max drawdown <2R (too good to be true; ignore slippage?)
Green flags (realistic data):
- ✅ 40–60% win rate
- ✅ Expectancy +0.1 to +0.3R
- ✅ Profit factor 1.3–2.0
- ✅ Max drawdown >5R
- ✅ Results consistent month-to-month
Step 5: Check for curve-fitting
Curve-fitting: Your setup works only on the data you tested, not on new data.
Test for it:
- Split your data: 60 trades in-sample, 40 trades out-of-sample
- Backtest on the 60 trades
- Run the same setup on the 40 untested trades
- Do results match?
If in-sample expectancy is +0.2R and out-of-sample is −0.1R, your setup is curve-fit. Don't trade it.
If both are around +0.15R, the setup is real.
Step 6: Forward test (paper trading)
Before trading real money, run the setup on new live data for 20–30 trades.
Use a paper trading account. Take the trades exactly as defined. Log results.
Do they match the backtest? If yes, you're ready to go live.
Common backtesting mistakes
Mistake 1: Ignoring commissions
❌ Backtest: +0.20R expectancy ❌ Commissions: $5 per trade on $50 risk = −0.10R ❌ Real expectancy: +0.10R (half of backtest)
Always include costs in the backtest.
Mistake 2: Ignoring slippage
❌ Exit at target $104 exactly in backtest ❌ In live trading: Actually exit at $103.50 (slippage) ❌ Loses 0.5% every time; hurts small samples
Model 1–2 tick slippage in backtest.
Mistake 3: Cherry-picking data
❌ "My setup works great in bull markets, so I'll backtest only 2023."
You've curve-fit to one market condition. Test in bear markets too. Test in chop.
Mistake 4: Not accounting for survivorship bias
❌ Backtest on SPY (survived since 1990)
SPY didn't exist in 1980. Companies that disappeared aren't in your data. You're testing a survivorship-biased set.
This is OK for SPY (it's the survivor). It's bad for individual stocks.
Mistake 5: Too few trades
❌ Backtest on 20 trades, see +0.3R expectancy
20 trades is luck. You need 100+ minimum, ideally 200+.
Compare Backtest vs Live, Trade by Trade
Log backtest and live trades side by side in TRADZY and see where the edge holds up.
Log Your Backtest Free →Backtest vs. live trading differences
| Factor | Backtest | Live |
|---|---|---|
| Slippage | None (or modeled) | Real |
| Commissions | None (or modeled) | Real |
| Execution | Perfect | Imperfect |
| Emotions | None | Real (can hurt) |
| Stop fills | Price-based | Might gap through |
| Market conditions | Fixed | Changing |
Expect: Live results to be 10–30% worse than backtest.
If backtest is +0.2R, expect live to be +0.14R–+0.18R.
If backtest is negative, live will be worse.
Backtesting tools
| Tool | Ease | Accuracy | Cost |
|---|---|---|---|
| Thinkorswim (manual) | Hard | Very high | Free |
| TradingView (built-in) | Easy | Medium (limitations) | Free/Paid |
| NinjaTrader | Hard | Very high | Paid |
| Amibroker | Very hard | Very high | Paid |
| Walk-forward in Excel | Hard | Very high | Free |
Start with TradingView or Thinkorswim manual review. Graduate to coded backtests once you're serious.
FAQ
Can I backtest options?
Yes, but more complex (need volatility data). Most backtesting tools handle it.
Should I optimize for best parameters?
No. Use what makes logical sense. Optimizing creates curve-fit. Example: Don't test 50–100 SMA lengths looking for the best. Pick 50 SMA because market structure supports it.
How long should I backtest?
100–300 trades minimum. If your setup is rare, backtest a longer time period.
Can I trust a backtest?
Partially. Backtest validates the logic. Live trading validates the execution and psychology.
What if my backtest is negative?
Your setup probably doesn't have edge. Test a different setup or a different market.
Should I paper trade before live trading after backtesting?
Yes, absolutely. 20–50 paper trades to confirm results translate.
Put This Into Practice
- Log backtest trades with the same fields as live ones
- Compare win rate, average R and expectancy side by side
- Go live only when the numbers hold
Start Free in TRADZY →
Educational content, not financial advice. Trading involves substantial risk of loss.