2022-11-07 16:32
老师您好,请教一个问题,刚接触bt不久,前一日的收盘价>=当前收盘价,作为一个指标,运行发现运行结果不对,帮忙指正一下
class tfs(bt.Indicator):
lines = ("fs",)def __init__(self):
self.dataclose = self.datas[0].close
self.datalow = self.datas[0].low
self.datahigh = self.datas[0].close
self.addminperiod(20)
self.plotinfo.plot = self.p.myplot
self.l.fs = bt.If(self.dataclose[-1] >= self.dataclose,True,False)
def next(self):
print('datetime', self.data0.lines.datetime.date(0))
print(self.dataclose[-1])
print(self.dataclose[0])
print("---------------------")
print(self.l.fs[0])
print("=====================")