For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Developing an indicator with other indicators
-
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 atbt.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()
heredef 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?