Skip to content

Cancelling order if not filled after bar duration #567

Answered by kernc
julzKB asked this question in Q&A
Discussion options

You must be logged in to vote

Best to look in the API reference. There is Strategy.orders and Order.cancel, so something like this should work:

    def next(self):
        # Close previous bar's orders *before* opening any new ones
        for order in self.orders:
            order.cancel()

        # Open new orders for this bar
        ...

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@julzKB
Comment options

@kernc
Comment options

kernc Jan 9, 2022
Maintainer

@julzKB
Comment options

Answer selected by julzKB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants