For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
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 = self.buy(transmit=False) stop_price = self.data.close[0] - 30 self.buy_stop = self.sell(exectype=bt.Order.Stop, price=stop_price, parent=self.buy_order)
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.
self.close() if self.buy_stop: self.cancel(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?
Thanks!
-
Differently put, is there a logic invoked if a parent order is closed regarding its child orders?