Replies: 1 comment
-
This matches whenever the current value is greater than the previous: def next(self):
if self.data.Close[-1] > self.data.Close[-2]:
... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys!
I've read this in the manual.
"Within Strategy.init(), data arrays are available in full length, as passed into Backtest (for precomputing indicators and such). However, within Strategy.next(), data arrays are only as long as the current iteration, simulating gradual price point revelation. In each call of Strategy.next() (iteratively called by Backtest internally), the last array value (e.g. data.Close[-1]) is always the most recent value."
Now: I'd like to open a buy position only if the close price of the next candle is greater than the previous.
Can I do this? From the manual, I think that I cannot do it.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions