I am placing stops like below and they sometimes get executed instantaneously, both in backtests and live paper trading. On the image, you can see that a JD position was opened on the close of the bar at 9:31, but the stop was executed right away at a price that is outside the range of the bar.

 

quantity = math.floor(self.Portfolio.TotalPortfolioValue * 3 / symbolData.Bars[0].Close) stopPrice = symbolData.Bars[0].Close- (symbolData.Bars[0].Close * Decimal(0.0166)) self.CurrentOrder = self.MarketOrder(symbol, quantity) self.CurrentStopOrder = self.StopMarketOrder(symbol, -quantity, stopPrice)