My script reads resistance prices from a txt file. If the market price gets as close as 3.5 points from the resistance price, a SellShortStopMarket order is submitted 5 points lower. But in some cases during playback after the SellShortStopMarket order is submitted the price has already moved 5 points lower and I'm getting this error: "Sell stop order can't be placed above the market". I attached a picture where there are 2 scenarios. First order gets submitted but on the second one I get the error. I also measured the time between when price triggers my order and when price reaches the triggered order's stop price and its over half a second which should be more than enough for an order to get submitted, right? I also attached my code together with the txt file.
I know that during playback the price is updated down to 100 nanosecond level, but here it doesn't seem to be the case.
I made my script cleaner and got rid of most of the code. I played through playback many times with the lowest speed and also switched to 10 tick chart to see if it makes a difference, but i get the same result. Might the problem be in the data feed that my playback is currently using which is CQG or does an order really take more than half a second to get submitted?
What other options are there to make sure the playback goes through the price tick by tick and to make my order execution as fast as possible?
Thank You!
Comment