Interactive Brokers Order Rejected
I am using Backtrader with Interactive Brokers as my strategies broker and I notice that I am receiving rejected orders more often than usual. I am sending bracket orders with a regular stop and a trailing stop. Since my entry order is a limit order it is possible for it to get filled in different parts at different prices so in the notify_order method I cancel my stop losses and resend two more that are based off of the filled price. Could this be the reason as to why I am getting Order.Rejected? On the Interactive Brokers software I can see that all parts of my bracket order went through and are being held in the system so I am confused as to why I am getting a rejected signal in Backtrader. Any feedback is appreciated, thanks.
It seems a complex situation. Without some logs it is really impossible to think what may be happening to you. You say that you send bracket orders, but at the same time it seems that you actually manage the bracket manually.
Interactive Brokers has a ton of codes and they are (or at least were) poorly documented. The default when an order is no longer alive and the received code is not well-known is to indicate a Rejection. This may be your case.