code: def chande_momentum_oscillator(close_data, period):
      
      catch_errors.check_for_period_error(close_data, period)
  
      close_data = np.array(close_data)
  
      moving_period_diffs = [[(close_data[idx+1-period:idx+1][i] -
                   close_data[idx+1-period:idx+1][i-1]) for i in range(1, len(close_data[idx+1-period:idx+1]))] for idx in range(0, len(close_data))]
  
      sum_up = []
      sum_down = []
      for period_diffs in moving_period_diffs:
          ups = [val if val > 0 else 0 for val in period_diffs]
          sum_up.append(sum(ups))
          downs = [abs(val) if val < 0 else 0 for val in period_diffs]
          sum_down.append(sum(downs))
  
      sum_up = np.array(sum_up)
      sum_down = np.array(sum_down)
      # numpy is able to handle dividing by zero and makes those calculations
      # nans which is what we want, so we safely suppress the RuntimeWarning
      with warnings.catch_warnings():
          warnings.simplefilter("ignore", category=RuntimeWarning)
          cmo = 100 * ((sum_up - sum_down) / (sum_up + sum_down))
      return cmo
docs: Chande Momentum Oscillator.
  
      Formula:
      cmo = 100 * ((sum_up - sum_down) / (sum_up + sum_down))