public void OnData(TradeBars data) { bool IsMarketOpen = Securities["SPY"].Exchange.DateTimeIsOpen(Time); if (IsMarketOpen) { NoOrderTime = Time.AddMinutes(10); } foreach (var security in selectedSymbols) { var openOrders = Transactions.GetOpenOrders(security); if (Time <= NoOrderTime) { if (Portfolio[security].Invested==false) { if (openOrders.Count == 0) { SetHoldings(security, 0.1); } } } if (Time > NoOrderTime) { if (openOrders.Count > 0) { Transactions.CancelOpenOrders(security); } } }

 

It seems that the above code is not working. Could someone help me? Thanks.