"How can I troubleshoot entry orders not filling?"
By Dave Mabe
Here's a question from Angel R. (name used with permission):
Angel R.:
I've been testing an intraday trading strategy. I wanted to ask you about the following:
I'm trading with IB-Gateway on a VPS located in the US. Everything looks good, but lately I've noticed a delay in IBKR executing my entry orders (more than 10 seconds, up to 1 minute!), which includes increased slippage in the entry price. I use a market order for my entry. I have a safety mechanism in place to cancel the entry order and the bracket order after a 15-second delay if they aren't executed. I implement this by canceling the parent order.
I had considered using a limit order for my entry, but I'm worried that the placed order might not be executed.
What do you think of this approach? Is there a better way to handle this situation?
Dave:
Interesting situation. I'm surprised that you would see such a long delay in the execution of a market order.
The first thing I would do is send a message to IBKR support about the order and why it didn't execute.
It will take them a bit to get back to you, but they should come back with an answer about the specific order.
In the meantime, I would add some debug logging to your software to log when certain events happen, for example:
Signal triggered
Orders generated
Orders submitted
Orders rejected/canceled
This way, you have a complete forensic picture after the fact that you can use to figure out where the delays are.
Using the IBKR gateway (versus TWS) is a good idea for this type of setup to minimize the memory footprint on the VPS, but I like using TWS to view the orders and modify them if needed.
Here are the non-default fields I add to my orders grid in TWS:
Submit Time - time order was submitted and made live on IBKR order servers
Details - one field that shows the applicable price field for orders: i.e. limit price for Limit orders, stop for Stop orders
Start Time - the good after time for the order (for timed exits)
End Time - the good until time, mostly for entry orders
OCA Group - the one-cancels-all group id
Order Ref - can be used as a client field for use in your program - I normally include the strategy name
Fill Price - fill price for the order, if executed
I would also look at Time and Sales at the time of your order to see what the market looked like, and then brainstorm a different approach to get a fill without too much slippage.
You can use T&S to see what the best limit price you could have used for the entry order that would have gotten filled.
Thanks for the question, Angel, and for sharing with the group.
-Dave
P.S. Why is every other trader printing money while you’re stuck? Close the gap with MabeKit. Get Instant Access