code: def __init__(self):
      # Before super to ensure mixins (right-hand side in subclassing)
      # can see the assignment operation and operate on the line
      direction = self.data - self.data(-self.p.period)
      volatility = SumN(
          abs(self.data - self.data(-1)), period=self.p.period
      )
  
      er = abs(direction / volatility)  # efficiency ratio
  
      fast = 2.0 / (self.p.fast + 1.0)  # fast ema smoothing factor
      slow = 2.0 / (self.p.slow + 1.0)  # slow ema smoothing factor
  
      sc = pow((er * (fast - slow)) + slow, 2)  # scalable constant
  
      self.lines[0] = ExponentialSmoothingDynamic(
          self.data, period=self.p.period, alpha=sc
      )
  
      super(AdaptiveMovingAverage, self).__init__()
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from .None import SumN, MovingAverageBase, ExponentialSmoothingDynamic
label_desc: Use image node_id 1 to create a new AdaptiveMovingAverage object from inherited base classes: MovingAverageBase with example: obj = AdaptiveMovingAverage()