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
Joe 0 last edited by
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.MovingAverageSimpleand for ATR at
bt.indicators.atr.AverageTrueRangemy 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
def next(self): self.line = \ 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.movavis supposed to be but that wasn't so obvious)
How do I go about making this integrated indicator?