Learn 12

Chapter 11: Backtesting, Samples, and Strategy Research

11.1 Why Backtest

Backtesting is not to certify future profitability. It answers:

  • Did this rule repeat historically?
  • What are approximate win rate, reward-to-risk, and drawdown?
  • Can you survive losing streaks?
  • Does it still work after fees and slippage?
  • In what market states does it perform poorly?

Without backtesting, a strategy may be only a few pretty screenshots.

11.2 Basic Backtest Elements

A basic backtest must define:

Instrument:
Timeframe:
Sample period:
Entry rules:
Exit rules:
Stop rules:
Target rules:
Position sizing:
Fees:
Slippage:
Maximum simultaneous positions:
No-trade conditions:

The vaguer the rule, the easier the self-deception. “Enter on strong candle” is not enough; strong candle must be defined.

11.3 Common Backtest Traps

Overfitting:

Adjusting parameters repeatedly to make history look good. Overfit strategies look beautiful historically and fail in the future.

Survivorship bias:

Testing only instruments that still exist or performed well, ignoring delisted or failed samples.

Look-ahead bias:

Using information that was not available at the time, such as end-of-day data for intraday entry.

Ignoring costs:

Ignoring fees, slippage, spread, and funding greatly overestimates short-term strategies.

Too few samples:

A few successful cases do not prove validity. You need enough trades across market states.

Over-idealized simulated fills:

If a backtest assumes every signal fills fully at the signal price, it underestimates real execution difficulty. Breakouts, opens, post-news moves, and low-liquidity instruments may involve slippage, partial fills, wider spreads, or no fill.

11.4 Out-of-Sample Validation

Split data:

  • In-sample: design and tune rules.
  • Out-of-sample: test whether rules still work.

If a strategy only works in-sample and fails out-of-sample, it may only fit historical noise.

Forward testing can also be used: execute in real time with small size or simulation and observe costs, psychology, and slippage.

Out-of-sample data should be locked before validation. If you keep changing parameters until out-of-sample results also look good, the out-of-sample set becomes a new in-sample set and loses validation value.

11.5 Strategy Evaluation Metrics

Besides total return, observe:

  • Maximum drawdown.
  • Reward-to-risk.
  • Win rate.
  • Expectancy.
  • Longest losing streak.
  • Profit factor.
  • Average holding time.
  • Largest single loss.
  • Whether gains come from a few extreme trades.

A high-return strategy with huge drawdown may not be executable. A suitable strategy must work mathematically and psychologically.

Backtest results also need stability checks. If returns come mainly from a few extreme trades, or small parameter changes make results collapse, the strategy may depend on accidental samples. Before live trading, check whether results remain acceptable across different years, volatility regimes, and cost assumptions.

11.6 Practice

Choose a simple model, such as “in an uptrend, enter after price pulls back to 20EMA and forms bullish engulfing.” Manually test the most recent 100 samples:

  • Did each entry strictly meet the rules?
  • What were maximum loss and maximum gain?
  • Could it actually fill?
  • What was R-multiple after fees and slippage?
  • What was the longest losing streak?

This is closer to real progress than repeatedly watching fragmented trading content.