Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    How to cancel only parent order in bracket.

    General Code/Help
    1
    4
    83
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kav last edited by

      Suppose I want to cancel all sell orders. I do:

                              if self.order:
                                  for this_order in self.order:
                                      if this_order.issell():
                                          self.cancel(this_order)
      

      but what if some of these orders are children orders left from filled brackets orders:

      --to keep the parlance of BT, main of the tripled [main, stop, limit] was a buy and filled. Now stop and limit are left (two sells). I want to delete all orders that are both main and sells. How do I do that?

      1 Reply Last reply Reply Quote 0
      • K
        kav last edited by

        I meant how to cancel only child order in bracket (can't find the edit button on this forum somehow).

        K 1 Reply Last reply Reply Quote 0
        • K
          kav last edited by

          To cancel only parent order, can I use:

                                  if self.order:
                                      for this_order in self.order:
                                          if this_order.issell():
                                              if not isinstance(this_order.price, type(None)):
                                                 cancel(this_order)
          
          1 Reply Last reply Reply Quote 0
          • K
            kav @kav last edited by

            @kav said in How to cancel only parent order in bracket.:

            I meant how to cancel only child order in bracket (can't find the edit button on this forum somehow).

            no, I really meant the parent order. Anyone knows where the edit button is on this forum?

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors