Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Joe 0
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Groups 0

    Joe 0

    @Joe 0

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Joe 0 Unfollow Follow

    Latest posts made by Joe 0

    • 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 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?

      posted in Indicators/Strategies/Analyzers
      Joe 0
      Joe 0