Diagnosing Duplicate Closes from Simultaneous CTA Stop Orders
Summary
A VeighNa community discussion investigates a CTA backtest in which the recorded position appears to exceed the strategy's actual holdings. The trader reports opening seven contracts, then seeing several stop orders close quantities that add up to more than the position. The issue occurred only twice across a long historical run, during extreme one-minute price moves when entry and exit stop orders were active together.
The discussion recommends logging strategy decisions and order requests, rather than relying only on the resulting trade records, to distinguish strategy behavior from framework execution. The trader later identifies the setup: a built-in Turtle strategy had additional stop logic in its trade callback, and opening and closing stop orders could both trigger within a ten-minute bar. The response advises revising the strategy logic. It offers no specific code fix or confirmed framework defect, so the case is a diagnostic lesson about order interactions and coarse bar timing, not a general resolution for all excess-fill anomalies.
Key ideas
- Log strategy logic and submitted order requests to investigate unexpected backtest fills.
- Trade records alone may not reveal whether the strategy or engine generated the behavior.
- Multiple stop orders can interact when entry and exit conditions trigger within the same bar.
- The reported case involved added stop logic in a Turtle strategy and extreme intrabar price movement.
- The discussion suggests reviewing strategy logic but does not provide a concrete fix or prove a framework bug.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.