I ran into a problem that sounds very simple to begin with, but still I could not find a solution to it. What I want to do is buy my fine universe selection on the open of the same day. Attached is a very simple back-test to demonstrate the problem. On 11-7-2023 my fine universe selection returns a list containing only ‘MSFT’ (Microsoft) as an example. on 9:20am the same day, 10 minutes before market open I set up a MarketOnOpenOrder, which I was hoping gets filled 10 minutes later at market open with the open price of 11-7-2023. Instead the order gets filled with the open price of 11-8-2023. After some discussion with the friendly support staff (kudos to Alex) I learned that in lean in back-testing a daily candle goes from midnight to midnight, i.e. the daily candle for 11-7-2023 is already underway at 9:20am. This is why the order gets filled with the open of next days candle. Understanding this unfortunately does not helping me solve my problem. One quick solution, suggested by Mia, does not work. Running the back-test on higher resolution (e.g. Minute, even though this looks like a terrible waste of resources) by setting line 21 of the back-test to:

self.UniverseSettings.Resolution = Resolution.Minute

This produces the error message:

Backtest Handled Error: MSFT R735QTJ8XC9X: The security does not have an accurate price as it has not yet received a bar of data. Before placing a trade (or using SetHoldings) warm up your algorithm with SetWarmup, or use slice.Contains(symbol) to confirm the Slice object has price before using the data. Data does not necessarily all arrive at the same time so your algorithm should confirm the data is ready before using it. In live trading this can mean you do not have an active subscription to the asset class you're trying to trade. If using custom data make sure you've set the 'Value' property.

and nothing gets bought.

My question is very simple, does anybody know how to buy the fine universe selection at the same day on market open? This sounds like a very common thing to do, and I have a hard time believing I am the first who ran into this issue.

Thank you for any kind of help,

      Markus