Hello,

I have question for the stopMarketOrder. The following is my code in the onData function where it submitted an MaerketOrder and StopMarketOrder together once the entry condition is met. However it looks strange in the backtesting. As you can see from the picture.  the MarketOrder and StopMarketOrder filled at the same second, there is more than 0.5 difference for the QQQ data at that specific time point, I am wondering why this can happen? Thanks

public override void OnData(Slice data){    

 TradeBars bars = data.Bars;

  if (entry_cond == true)

{  

  MarketTicket =  MarketOrder(_qqq, -100);

     var stopPrice = bars[_qqq].Close + 0.5M;
    var newTicket = StopMarketOrder(_qqq, 100, stopPrice);

}

}

81395_1565119837.jpg

 

Author