@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.
I would like to draw a plotline with nan values.
zz=dict(_name='zigzag', color='blue', ls='-', _skipnan=True
I have a condition which is activated several times and it sets the value for zz, the problems is that I want to delete the previous zz if this condition is met.
self.zz[-1] =None
self.zz[0] = self.data.high[0]
I have already tried this, but an error occurs:
line 222, in setitem
self.array[self.idx + ago] = value
TypeError: must be real number, not NoneType
I am ploting the indicators defined on strategy level.
All of them have values set a each point in the time-series.
However, I want to plot another line which is set only on a few occasions.
Furthermore I want the lines to connect this data-points. I don't want a repetition of the previous, until a change occurs, I already know how to do that.
To clarify, I want it to look like the black line in the chart below.
@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.
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