Continuous Futures Backtesting: Signals, Rolls, and P&L Without Look-Ahead
Verify price_raw + back_adjustment, make roll decisions with available information, and move signals into dated-contract fills and P&L without time travel.
You cannot trade the continuous line
A futures backtest needs two views of the market: a comparable price series for signals and the dated contract an order could actually use. A continuous file supplies the first. It does not remove the second.
The difference becomes expensive at contract rolls. Your model can keep a signal position through a continuous join, but an account has to close the outgoing contract and open the incoming one. Those are two transactions, often at different prices and always with costs to consider. Skipping them makes the equity curve smoother than anything a trader could reproduce.
The continuous datasets here use additive back adjustment:
price = price_raw + back_adjustment
price_raw is the original contract price, price is the adjusted research series, and back_adjustment links their levels across rolls. Keep all three when inspecting a transition. A close-only dataframe throws away the evidence.
Check the identity, then read the ledger
The first check is mechanical. Floating-point prices need a tolerance small enough to catch a scale error without failing on harmless representation noise.
import numpy as np
import pandas as pd
frame = pd.read_parquet("cme.mnq.tick.continuous.2026.parquet")
expected = frame["price_raw"] + frame["back_adjustment"]
assert np.allclose(frame["price"], expected, rtol=0, atol=1e-9)
assert frame["ts"].is_monotonic_increasing
The roll ledger records the source and destination contracts, decision session, switch timestamp and price difference. An adjustment change can help locate a candidate transition, but it cannot model the execution. Use the ledger for the contract map.
import json
with open("MNQ_rolls.json") as handle:
ledger = json.load(handle)
for roll in ledger["rolls"][:3]:
print(
roll["decision_session"],
roll["from_contract"],
roll["to_contract"],
roll["switch_utc"],
roll["difference"],
)
Confirm that each destination contract exists in the dated dataset when the simulated order would trade. A continuous row after the switch does not prove that your order type and size could have filled at that price.
Adjusted percentage returns are not account returns
Additive adjustment preserves point differences within its framework. It does not preserve percentage returns because it changes the denominator. The resulting percentage may never correspond to account performance, especially when adjustments are large.
# Avoid this as account P&L:
adjusted_return = frame["price"].pct_change()
# MNQ account P&L belongs to a dated contract:
pnl_usd = side * (exit_raw - entry_raw) * 2.00 * contracts
Adjusted differences can feed signal research. Account P&L belongs to the dated position: direction, raw entry and exit, multiplier and quantity. At a roll, close out the old contract’s P&L first, then open the new contract at its raw price. The gap between contracts is neither a windfall nor a loss.
Print every roll with the old raw exit, new raw entry, adjustment, gross point P&L and estimated costs. A large return exactly at the switch needs a dated position that explains it. Otherwise, the return calculation is probably wrong.
Tomorrow’s volume cannot authorize this morning’s roll
A roll rule has a decision time and an execution time. Suppose it switches after the destination contract’s session volume exceeds the source contract’s. That condition is known only after the relevant observations exist. The completed session total cannot justify a fill earlier that day.
The timestamps have to run forward:
- Compute the volume comparison using data available by timestamp T.
- Allow the roll decision at T or later, according to the strategy.
- Submit the exit and entry no earlier than the decision.
- Use the next eligible prices and charge both transactions.
Repeat the strategy across several plausible roll windows. The goal is to learn whether it depends on one fortunate transition, not to crown the best historical window as validated.
UTC sorts the rows; a calendar names the sessions
Exchange-local session labels require a timezone database and product calendar. Many CME sessions turn over at 17:00 Chicago, so a UTC calendar date and trading-session label can differ. Daylight-saving changes make a fixed hour offset wrong for part of the year.
frame["chicago_ts"] = frame["ts"].dt.tz_convert("America/Chicago")
# Keep the original UTC timestamp for sorting and joins.
# Use a session calendar to assign trading-day labels.
A plain resample("1D") on UTC timestamps cannot reproduce the published daily bars. Weekends, holidays, maintenance and early closes need explicit handling. A gap is not automatically missing data, and a carried-forward price during a closure is not an available fill.
The signal happens before the fill
Filling at the same close that generated a signal assumes knowledge and execution happened together. A cleaner default is to decide at the close and execute at the next eligible event. Add delay as a sensitivity case. If performance vanishes with a small delay, the result depends on timing that may be hard to reproduce.
Costs go beyond commissions: exchange and clearing charges where applicable, spread, slippage and both sides of each roll. Bars contain neither a full order book nor queue position, so they cannot support a claim of precise fill simulation. Use conservative scenarios and state that limitation.
gross_pnl = side * (exit_raw - entry_raw) * multiplier * contracts
net_pnl = gross_pnl - commissions - fees - estimated_slippage
Keep gross and net results side by side. High turnover can make a small signal look attractive before costs and unusable afterward. Report roll costs separately so readers can see how much drag comes from maintaining the position.
Keep the last period out of the design meeting
Arrange training, validation and final evaluation chronologically. Fit parameters on training data, make model choices on validation data, and evaluate the frozen rule once on untouched data. If that final period inspires another tweak, it has joined development.
Inspect rolls as episodes, not just aggregate performance. Compare results by contract, year, volatility regime and time around each switch. Profits from one mishandled roll or exceptional quarter do not show dependable behavior. Simple benchmarks, delayed execution, higher costs and alternative roll windows give the result some much-needed context.
For a file-level workflow, see MNQ historical data in Parquet. Then run the full backtesting checklist with the actual ledger, fills and cost assumptions beside the report.