Hello,

I am having trouble wrapping my head around how to accurately back test with market orders. I understand from the docs that Market Order will get filled immediately. The problem that I am encountering is that this is not accurate representation of how it will occur in a live environment. . 

For example, for a basic stop and reverse strategy using a MA crossover with 1 min data resolution consolidated into 15 min bars, if, in the OnDataConsolidatedHandler, a buy signal is generated at the close of 1500(MST) and a market order is placed here, the OnOrderEvent will have a an order fill with data of 1500 with the price of the 1500 close. In the real world, with these times in the futures market, this would not be possible as it would have been filled sometime after 1600 when the market re-opened. If I understand the docs correctly, placing a limit would eliminate this problem, however that is not really the intended functionality as I do want this to be a market order. 

It should be noted that I am intending for this to be a standard algorithm not really falling into the Alpha framework model. My question is, what would be the appropriate way to achieve theses results in a back test with Lean/QC? Where manual buy/sell signal generation occurs at the close of a bar, a market order is placed, and the market order should not actually be filled until the beginning of the next bar at that bars opening price at the very least.

 

Thank you,