Hi all - Currently running a day-trading backtest over a number of years where the main strategy is to enter short positions under certain circumstances. I'm using a consolidator to run over 5min bars. Exit is either take-profit at some decrease in price (related to a moving average) or stop-loss if price climbs too high (sorry, need to be a bit vague).

Naturally, some big gains and big losses are expected. However, I am observing some unexpected prices when the exit/buy orders are filled - in particular the buy price appears to be much higher than expected. I understand market orders may not be filled immediately, but checking the 5m charts, I do not see that the stocks in question ever reach the fill price during the time period in question! This is very odd to me - is it possible the historical data has some large errors?

Note that I use `self.MarketOrder(symbol, -quantity)` to enter the short position and  `self.Liquidate(symbol)` to exit the short position.

Here are two examples:

  1. I short SOBR on 9/21/22 at $3.31. Exit short 20m later, but its filled at $10! If we check chart for SOBR on this date, the price never goes above $3.50 on this date!
232516_1684334106.jpg

I also do some logging for the trades - we can see that the `tradebar.Close` value (argument to my `OnConsolidatedData` consolidator function) shows current price at $2.76, which my algorithm logic considers a take-profit signal.

232516_1684334480.jpg

 

2. Here's a more dramatic one: I short CVNA on 12/9/22 for $5.58. Order filled 10m later at $350 (lol). Can check CVNA never goes above $6 on this date. Unfortunately I don't have my logs for this example, but I am sure it would be similar to the first example.

232516_1684334836.jpg

 

If someone could please help me on this would be much appreciated! Implementing the strategy correctly is hard enough already. And please let me know if I can provide any other info that would help. Thanks!