For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Bracket Order Stop and Limit Orders Not Canceled on Position Reversal

  • I have a question with regards to bracket orders and the reversal of a position. I would expect the existing stop and limit order associated with the Short (parent) order to be canceled when the position changes to Long. But this isn't happening and wondering if they're existing a setting I might be missing?

  • I found a solution to the problem.

    1. You need to group the order in the parent-child relationship (this open up other issues, but another ticket for this)
    2. Using the ib_insync library to get API access to IBKR directly. Call the reqGlobalCancel(). IBKR has a security feature where the clientID who opens the order must cancel the order. The reqGlobalCancel function gets around that.

Log in to reply