For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
How to draw a line between two 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.
-
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 ????