Multiple Indicators Help
I have an indicator class where I am calculating a couple of indicators. The reason I have them all in one class is that they are dependent on one another. The problem is that when I plot this class it plots all of the indicators. So specifically it is plotting the beta, spread, spread moving average, and spread std upper and lower lines. The beta value is so large, however, that it is making the rest of the indicators not visible.
How do I plot all of the indicators within the same class except the beta value?
I can't just say beta = model.fit().params instead of self.beta because I use the beta in my strategy Class.
Any suggestions would be appreciated.
class Beta(bt.Indicator): lines = ("beta" , "spread" , "spread_sma15" , "spread_2sd" , "spread_m2sd" ) params = ( ("period_pct", 1), ("period_beta", 15), ) def __init__(self, strat=None): """"initialize the line assign it to a variable Any operation involving lines objects during __init__ generates another lines object Whereas during next it yields regular Python types like floats and bools""" self.strategy = strat self.line0 = self.strategy.datas.close self.line1 = self.strategy.datas.close self.addminperiod(self.params.period_beta + 1) def next(self): (...) #beta self.l.beta = model.fit().params #spread self.l.spread = l0_pct_change[-1] - l1_pct_change[-1] * self.l.beta #15 day Spread Moving Average datasum = math.fsum(self.l.spread.get(size=self.p.period_beta)) self.l.spread_sma15 = datasum / self.p.period_beta #15 Day Standard Deviations self.l.spread_2sd = ((((datasum - self.lines.spread_sma[link text](![link url](![image url](image url)))15) ** 2) / self.p.period_beta) ** 0.5) * 2 self.l.spread_m2sd = ((((datasum - self.lines.spread_sma15) ** 2) / self.p.period_beta) ** 0.5) * -2 ```]([image url]([link url](``` ~~ * ![link url](![0_1619379742578_Untitled.png](Uploading 100%) image url)~~ ```)))
I apologize. I accidentally included the link to the image in the code block. Ignore that last part.
run-out last edited by