Backtesting Futures Trading Systems
Backtesting Futures Trading Systems
Backtesting uses historical data to evaluate how a trading strategy would have performed. For futures, backtesting requires careful attention to contract rolls, margin requirements, and realistic transaction costs. Proper methodology separates robust strategy development from curve-fitting illusions.
Definition and Key Concepts
What Is Backtesting?
Backtesting applies trading rules to historical data to generate hypothetical performance results. For futures:
- Entry and exit signals based on price patterns, indicators, or fundamental data
- Position sizing according to margin and risk rules
- P/L calculation accounting for contract specifications
- Performance metrics (returns, drawdowns, Sharpe ratio)
Key Backtesting Components
| Component | Description | Futures-Specific Consideration |
|---|---|---|
| Price data | Historical prices | Continuous contracts, roll adjustments |
| Transaction costs | Commissions, slippage | Bid-ask spread, market impact |
| Position sizing | Contracts per trade | Margin requirements, leverage |
| Roll handling | Contract transitions | Roll returns, timing |
| Capital allocation | Account management | Margin utilization, drawdowns |
Continuous Contract Construction
Futures expire. To create a continuous price series for backtesting:
Methods:
- Unadjusted: Splice contracts at roll, creates price gaps
- Back-adjusted: Adjust historical prices to remove roll gaps
- Ratio-adjusted: Adjust by price ratio instead of difference
- Perpetual: Weight multiple contracts by time to expiration
Each method has trade-offs for different strategy types.
How It Works in Practice
Building a Continuous Price Series
Example: Crude Oil (CL) Roll
| Contract | Last Price Before Roll | First Price After Roll |
|---|---|---|
| CLH25 (March) | $75.00 | — (expired) |
| CLJ25 (April) | $75.50 | $75.50 |
Unadjusted series: Day before roll: $75.00 Day of roll: $75.50 Gap: +$0.50 (artificial gain if long)
Back-adjusted series: Subtract $0.50 from all historical prices: Day before roll: $74.50 (adjusted) Day of roll: $75.50 No artificial gap
When to use each:
| Method | Best For | Avoid For |
|---|---|---|
| Unadjusted | Short-term trades, level-based signals | Trend-following, P/L calculation |
| Back-adjusted | Trend-following, momentum | Absolute price levels, support/resistance |
| Ratio-adjusted | Log returns, volatility | Additive calculations |
Transaction Cost Modeling
Components of trading costs:
| Cost Type | Typical Range | How to Estimate |
|---|---|---|
| Commission | $0.50-2.50/contract | Known from broker |
| Exchange fees | $0.50-1.50/contract | Published by exchange |
| Slippage | 0.5-2 ticks | Market impact modeling |
| Bid-ask spread | 1-5 ticks | Average from tick data |
Total cost per round-trip: Commission: $2.00 × 2 = $4.00 Slippage: 1 tick × 2 = $20.00 (for ES) Total: $24.00 per contract round-trip
For a system trading 500 round-trips per year on 10 contracts: Annual transaction costs: 500 × 10 × $24 = $120,000
Margin and Position Sizing
Risk-based position sizing:
| Parameter | Value |
|---|---|
| Account size | $500,000 |
| Risk per trade | 1% ($5,000) |
| Stop distance | 20 points (ES) |
| Dollar risk per contract | 20 × $50 = $1,000 |
| Position size | $5,000 ÷ $1,000 = 5 contracts |
Margin check: 5 contracts × $12,000 margin = $60,000 (12% of account) Passes margin constraint.
Worked Example
Trend-Following System Backtest
System rules:
- Entry: 50-day high breakout (long) or 50-day low breakdown (short)
- Exit: 25-day opposite breakout
- Position sizing: 1% account risk
- Markets: ES, CL, GC, ZN
Backtest parameters:
| Parameter | Value |
|---|---|
| Period | 2015-2024 (10 years) |
| Starting capital | $1,000,000 |
| Transaction costs | $30/contract round-trip |
| Data | Back-adjusted continuous contracts |
| Roll method | Roll 5 days before expiration |
Results summary:
| Metric | Value |
|---|---|
| Total return | +187% |
| CAGR | 11.1% |
| Max drawdown | -23% |
| Sharpe ratio | 0.82 |
| Win rate | 38% |
| Average win/loss | 2.8:1 |
| Total trades | 847 |
| Transaction costs | -$254,100 |
Year-by-year breakdown:
| Year | Return | Max DD | Trades |
|---|---|---|---|
| 2015 | +8% | -12% | 92 |
| 2016 | +22% | -8% | 78 |
| 2017 | -3% | -14% | 95 |
| 2018 | +15% | -11% | 88 |
| 2019 | +12% | -9% | 84 |
| 2020 | +45% | -18% | 102 |
| 2021 | +18% | -13% | 79 |
| 2022 | +31% | -16% | 96 |
| 2023 | -5% | -23% | 87 |
| 2024 | +11% | -10% | 46 |
Observations:
- Returns clustered in trending years (2020, 2022)
- Negative years (2017, 2023) during choppy markets
- Transaction costs material (~14% of gross profits)
Roll Return Impact
Without roll adjustment: Gross system return: +205% With roll costs: +187% Roll drag: -18% over 10 years (~1.8%/year)
This reflects:
- Contango in oil (negative roll)
- Mixed term structure in gold
- Quarterly rolls in equity and bond futures
Risks, Limitations, and Tradeoffs
Overfitting
The most dangerous backtest error:
- Optimizing parameters to fit historical data
- Many degrees of freedom = false discoveries
- Out-of-sample performance disappoints
Mitigation:
- Use simple rules with few parameters
- Reserve out-of-sample period for validation
- Cross-validate across multiple markets
Survivorship Bias
Historical data may exclude:
- Delisted contracts
- Failed exchanges
- Changed specifications
Test on data that includes losers, not just surviving instruments.
Look-Ahead Bias
Using information not available at decision time:
- Adjusted prices that use future roll prices
- End-of-day prices for intraday decisions
- Revised economic data instead of initial releases
Unrealistic Fills
Assuming fills at exact historical prices ignores:
- Market impact of your order
- Liquidity constraints during volatility
- Slippage during fast markets
Common Pitfalls
-
Ignoring transaction costs: A profitable system before costs may be unprofitable after realistic cost modeling.
-
Using unadjusted data for P/L: Roll gaps create artificial profits or losses.
-
Overtrading: Systems with many trades compound transaction costs.
-
Parameter optimization: The "best" parameters in-sample are often worst out-of-sample.
-
Ignoring margin utilization: Leverage amplifies both returns and drawdowns—stress-test margin calls.
Checklist for Futures Backtesting
- Select appropriate continuous contract methodology
- Include realistic transaction costs (commission + slippage)
- Model roll returns explicitly
- Apply proper position sizing based on margin and risk
- Reserve out-of-sample period for validation
- Test across multiple markets (not just one)
- Avoid excessive parameter optimization
- Verify no look-ahead bias in signals
- Stress-test margin utilization during drawdowns
- Document all assumptions and methodology
Next Steps
For tax implications of futures trading results, see Tax Treatment of Section 1256 Contracts.
To compare futures with alternative instruments, review Margin Efficiency vs. ETFs or Swaps.