code: function ma(close, n = 5) {
      let result = [];
      let len = close.length
      if (len === 0 || n <= 0) {
          return result
      }
      let avg = close[0]
      result.push(avg)
      for (let i = 1; i < len; i++) {
          if (i < n) {
              let sum = close[0]
              for (let j = 1; j <= i; j++) {
                  sum += close[j]
              }
              avg = sum / (i + 1)
          } else {
              avg += (close[i] - close[i-n]) / n;
          }
          result.push(avg)
      }
      return result
  }
docs: Moving Average