My current simple MA crossover strategy sometimes opens a position in the very last second of the market close, and I need to prevent that. I was thinking to use Flatten() as follows,
Account.Flatten(new[]{Instrument.GetInstrument("MES DEC23")});
but I have two issues with this: First, I'm unsure how to set a specific time for this (end of NY session i.e. 4pm ET). Second, I'm worried that even after flattening all positions, the strategy might still open new ones. If there's a more effective way to ensure that the strategy not only refrains from opening new positions but also closes all existing ones by the market's end, I would greatly appreciate your assistance. Thank you very much!

Comment