@run-out said in How to get the index of the current iteration in next?:
@borutf You can get the current bar but using
len(self)
Thanks.
@run-out said in How to get the index of the current iteration in next?:
@borutf You can get the current bar but using
len(self)
Thanks.
2022-05-17 23:59:59.999989
This happens to every datetime??
I always use bt.feeds.PandasData , it can work on yfinance downloads as well.
@rapha It is possible that it is about the Python version change.
params = dict(
target_n_positions=20
)
You could try by defining the params inside in a dict, as shown above.
When I run both the tuple and dict approaches work, but who knows. I run backtrader in a environment in 3.8, as I have found some troubles with the newer versions.
@goloap the thing that helped me was
notify_cashvalue = BaseStrategy.notify_cashvalue
you can do this for all the methods you want to inherit from the BaseStartegy class.
Hello,
I am very new to Backtrader, hence I have a pretty simple question.
I understand you use self.data.low[0] to get let's say the low value of the current iteration, as 0 is the index by which you access the current data.
But how do you the index of the current iteration? Let's say you are at the 100th example in the time-series. Where do you access this value?
Best Regards,
Borut