Hi,

I am trying to test an algo strategy on QuantConnect, and when I run the following code, I notice that the stop-limit orders are getting sent, but they are never being filled. For example, the program correctly sent a buy order for SPY on 3/9/23 at the correct price, which is the high of the previous bar (3/8/23). On the SPY chart, the high of 3/8/23 was breached on 3/9/23 and thus, the buy order should have been executed. But when I look at the strategy equity graph, I see that none of the orders are getting filled and the equity remains the same throughout the entire backtest. Could someone please explain what is going wrong with my backtest? 

 

Ps: I included the below line because I only want the order to be valid for one day. For example, if the program identifies the signal on 3/8/23, the order should be placed before the market opens on 3/9/23 and should be canceled if it is not filled after the market closes on 3/9/23. 

self.DefaultOrderProperties.TimeInForce = TimeInForce.Day