For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Bracket orders - am I supposed to only have one open at a time?
booboothefool last edited by
In the documentation: https://www.backtrader.com/blog/posts/2017-04-01-bracket/bracket/
There is code like:
def next(self): if self.orefs: return # pending orders do nothing
def notify_order(self, order): if order.status == order.Completed: self.holdstart = len(self) if not order.alive() and order.ref in self.orefs: self.orefs.remove(order.ref)
self.orefs = [o.ref for o in os] else: # in the market if (len(self) - self.holdstart) >= self.p.hold: pass # do nothing in this case
I am wondering what the point of all this is? It makes it look like it's not a good idea to have multiple brackets open at a time. I am indeed running into issues with duplicates/bracket orders hanging around. Can someone clarify if I should be using this template of "pending orders do nothing"?
run-out last edited by
Indeed with one data there should only be one bracket open. However, when using multiple datas, then you need a dictionary to manage the orders. See the article here and the code at the bottom.