Skip to content
All library documents

Handling Different Pre-Market State in Backtests and Simulation

Article BigQuant

Summary

This forum post reports a difference in how a trading platform handles a day counter in development backtests versus simulated trading. The counter behaves as expected in backtests but remains at one in simulation, prompting questions about whether the context value persists between pre-market function calls. The post records a suggested workaround: move the relevant pre-market code into the bar handler.

The discussion does not include a working example, a confirmed explanation of why the environments differ, or details about which state variables persist. A follow-up asks for an example and says the workaround is unclear. As a result, this is a useful troubleshooting clue for platform users, but it does not establish a general rule or provide enough detail to implement or validate the workaround confidently.

Key ideas

  • The post reports that a day counter behaved differently in backtests and simulated trading.
  • In the reported simulation, the counter stayed at one.
  • A suggested workaround was to place the relevant pre-market logic inside the bar handler.
  • The post gives no example or confirmed explanation for the difference in behavior.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.