Hey, I would like to make an indicator for the following formulas:
SMA - 0.2ATR, SMA + 0.2ATR
I can source the value for SMA with bt.indicators.MovingAverageSimple
and for ATR at bt.indicators.atr.AverageTrueRange
my question is how can I combine them to make a sub-indicator that accounts both of these values?
It appears that SMA calculates the values on next()
here
def next(self):
self.line[0] = \
math.fsum(self.data.get(size=self.p.period)) / self.p.period
But ATR calculates it here:
self.lines.atr = self.p.movav(TR(self.data), period=self.p.period)
(I tried to backtrack what self.p.movav
is supposed to be but that wasn't so obvious)
How do I go about making this integrated indicator?