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

Closing parent orders (bracket orders) - what to do with child orders?

  • Hi,
    Please forgive me if this is an already answered questions I couldn't find this specific information.

    I created a parent order with a child order being some kind of stop loss. Now, the parent order is executed and the child limit order is submitted/accepted as expected.

    self.buy_order =
    stop_price =[0] - 30
    self.buy_stop = self.sell(exectype=bt.Order.Stop, price=stop_price,

    In some cases, I need to close my positions by some logic and my question is if I have to cancel the child orders manually, e.g.

    if self.buy_stop:

    or if there is a better approach to this?

    The same question applies for buy_bracket orders. If I close my positions, do I need to manually clean/cancel any associated child_orders stemming from the bracket order?


  • Differently put, is there a logic invoked if a parent order is closed regarding its child orders?

Log in to reply