Preserving Strategy State During Futures Contract Rollover
Summary
This forum exchange discusses what happens to a futures strategy when it rolls from one lead contract to the next, especially when the contracts have a price gap. The reply explains that rolling changes the contract used by the strategy. During initialization, the engine loads data for the new contract and runs the initialization process, then restores previously cached strategy variables.
That sequence does not guarantee that every indicator or state variable remains valid. Values that cannot be reconstructed from the replayed history may be affected; the example given is the high or low tracked during an open trade for a trailing stop. The practical lesson is to inspect which variables rely on contract-specific history and whether the initialization data can rebuild them. The exchange offers a conceptual answer, not implementation instructions: although the question also asks where rollover code resides, the reply does not identify a file or provide a code example.
Key ideas
- A futures roll changes the contract symbol used by the strategy.
- Initialization loads history for the new contract before the engine restores cached variables.
- Variables that cannot be rebuilt from replayed data may become stale or incorrect after a roll.
- Trade-specific highs and lows used by trailing stops are given as examples of potentially affected state.
- The reply advises checking variable dependencies but does not locate the rollover code.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.