I use this code implement it.
self.lines.dummyline[0] = max(float('NaN'), float('NaN'))
thanks.
I use this code implement it.
self.lines.dummyline[0] = max(float('NaN'), float('NaN'))
thanks.
I use this code implement it.
self.lines.dummyline[0] = max(float('NaN'), float('NaN'))
thanks.
from the document, We can see
_skipnan (bool, default: False): to skip NaN values when plotting and allowing for example to draw a line between 2 distant points generated by an indicator, which has all intermediate values as NaN (default value for new created data points)
I also set the value, but not take effect.
How to draw a line between 2 distant points ????
how to draw a line between two points, I set other points as NAN, then the lines cannot show,
for these code:
class DummyInd(bt.Indicator):
lines = ('dummyline',)
plotinfo = dict(subplot=False,_skipnan=True, plotforce=True, plotname='1stInd',plotymargin=0.1)
params = (('period', 1),)
count =0
def __init__(self):
self.lines.dummyline = bt.Max(float('NaN'), float('NaN'))
super(DummyInd, self).__init__()
def next(self):
DummyInd.count +=1
if DummyInd.count % 30==0:
self.lines.dummyline[0] = self.data.close[0]+1.5
print(self.lines.dummyline[0])
else:
# self.lines.dummyline[0] = max(float('NaN'), float('NaN'))
self.lines.dummyline[0] = 10
I get the picture as following:
I want get line as the green line.
but when I use the following code , set other points as NAN, then will get nothing.
def next(self):
DummyInd.count +=1
if DummyInd.count % 30==0:
self.lines.dummyline[0] = self.data.close[0]+1.5
print(self.lines.dummyline[0])
else:
self.lines.dummyline[0] = max(float('NaN'), float('NaN'))
#self.lines.dummyline[0] = 10
how to get the lines between 2 points.
how to initial a line object as NaN, only set some points had value
I want set the data point per 10 days, and connect the points, need set other data point value as NAN, hot to set it
class DummyInd(bt.Indicator):
lines = ('dummyline',)
plotinfo = dict(subplot=False,_skipnan=False)
params = (('value', 0),('period', 1),)
count =0
def __init__(self):
self.lines.dummyline = numpy.nan #error here, do not know how to set.
def next(self):
DummyInd.count +=1
if DummyInd.count % 10==0:
self.lines.dummyline[0] = self.data.close[0]