Hello,

Noob question here.  I am doing a backtest on US SPW index options and I noticed my stop orders kept getting filled at seemingly crazy prices.  I dug a little deeper and pulled the data and noticed several instances of the minutely data where the ask high/low or bid high/low did not make any sense to me.  The data seems to be rolled up from tick data provided by algoseek, so I cannot say for sure whether this happens a lot but as a trader of several years, this doesn't make sense to me.  Below is an example of what I am describing.  There are many more examples of this, even within the same trading day and with other option securities.  In the below example, the ask high is 30.00, the ask low is 0.20 and the ask close is .25.  This is the first minute bar after the open, but this also occurs throughout the day.  This is impossible to me because even if the ask high is 30, the bid high is 0.15.  There is no way that this relatively liquid market was 0.15 x 30.00 at best bid and offer, the arbitrageurs would have nipped that before it ever got that far.  This causes my stop buy orders to fill at any price on this bar up to a stop price of $30 in this example.

Since quantconnect just pulls this data from algoseek and cleaning all of it would be beyong my scope, my question is about working around this.  Is there a way to write some logic into onData that examines this and stops the backtester from filling at $30?  Perhaps a way to tell the backtester to only execute using bid or ask close?  Or to scan the high/low numbers and compare them to the opposite side and override the high/low numbers to something reasonable like one tick over/under the opposite high/low?

 

Thank you!

 

striketypesymboltimeaskcloseaskhighasklowaskopenbidhighbidlowbidopenbidsizeclosehighlowopenvolume3630PutSPXW 31YNZ3KMVDSLQ|SPX 316/23/2022 8:310.25300.20.250.150.10.151720.20.250.20.259