For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Get list of orders?
-
I've recently run across Backtrader. It is an impressive piece of software, but I think the learning curve is a bit steep (at least for me!) ;-(
My question: I don't want to enter an order if I already entered one in the previous one or two days. So, I just want to check whether an order was entered. Something like this pseudo-code:
if not order[-2] and not order[-1]: order.buy()
How would I do that?
-
Whenever you create a new order, track the length of self (current index) in a variable.
So in your strategy:
def __init__(self): self.track_last_order = 0 def next(self): if (len(self) - self.track_last_order) > 2: # you make a new order here... then self.track_last_order = len(self)
-
@run-out Thank you!