Tracking Simulated Positions and Selling After Three Trading Days
Summary
The document describes a stock strategy that scores candidates with a neural network, buys up to three holdings, and aims to sell each after three trading days. It stores each stock and its entry-day index in a context list, then compares that index with the current trading-day index to decide when to exit. The author reports that this list behaves as expected in backtests but is empty before purchases in live simulation, and also observes duplicate dates in a trading-day query.
These are troubleshooting questions rather than resolved findings: the document gives no confirmed cause or tested fix for either issue. Its code illustrates risks in relying on in-memory strategy state across simulation runs, updating holdings immediately after submitting orders, and using a date source with duplicate rows. The exit check is also reached only after candidate data is generated, so an empty candidate set can bypass selling. Readers should treat the example as a debugging case, not a validated implementation.
Key ideas
- The strategy records each entry alongside a trading-day index and checks the elapsed index to trigger an exit.
- The author reports that the in-memory holdings list is empty in simulation despite apparent open positions.
- The document also reports duplicate dates in a queried trading calendar but does not identify their cause.
- Exit processing can be skipped when the handler returns early because candidate data is empty.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.