code: from typing import Union
  
  import numpy as np
  from numba import njit
  
  from jesse.helpers import get_candle_source, slice_candles
  
  
  def supersmoother(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> Union[
      float, np.ndarray]:
      """
      Super Smoother Filter 2pole Butterworth
      This indicator was described by John F. Ehlers
  
      :param candles: np.ndarray
      :param period: int - default=14
      :param source_type: str - default: "close"
      :param sequential: bool - default=False
  
      :return: float | np.ndarray
      """
  
      candles = slice_candles(candles, sequential)
  
      # Accept normal array too.
      if len(candles.shape) == 1:
          source = candles
      else:
          source = get_candle_source(candles, source_type=source_type)
  
      res = supersmoother_fast(source, period)
  
      return res if sequential else res[-1]
  
  
  @njit
  def supersmoother_fast(source, period):
      a = np.exp(-1.414 * np.pi / period)
      b = 2 * a * np.cos(1.414 * np.pi / period)
      newseries = np.copy(source)
      for i in range(2, source.shape[0]):
          newseries[i] = (1 + a ** 2 - b) / 2 * (source[i] + source[i - 1]) \
                         + b * newseries[i - 1] - a ** 2 * newseries[i - 2]
      return newseries
   from typing import Union
  
  import numpy as np
  from numpy.lib.stride_tricks import sliding_window_view
  
  from jesse.helpers import get_candle_source, slice_candles, same_length
  
  
  def sinwma(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> Union[
      float, np.ndarray]:
      """
      Sine Weighted Moving Average (SINWMA)
  
      :param candles: np.ndarray
      :param period: int - default: 14
      :param source_type: str - default: "close"
      :param sequential: bool - default=False
  
      :return: float | np.ndarray
      """
      candles = slice_candles(candles, sequential)
  
      source = get_candle_source(candles, source_type=source_type)
      sines = np.array([np.sin((i + 1) * np.pi / (period + 1)) for i in range(0, period)])
      w = sines / sines.sum()
      swv = sliding_window_view(source, window_shape=period)
      res = np.average(swv, weights=w, axis=-1)
  
      return same_length(candles, res) if sequential else res[-1]
   from collections import namedtuple
  
  import numpy as np
  import talib
  from numba import njit
  
  from jesse.helpers import get_candle_source
  from jesse.helpers import slice_candles
  
  DamianiVolatmeter = namedtuple('DamianiVolatmeter', ['vol', 'anti'])
  
  
  def damiani_volatmeter(candles: np.ndarray, vis_atr: int = 13, vis_std: int = 20, sed_atr: int = 40, sed_std: int = 100,
                         threshold: float = 1.4, source_type: str = "close",
                         sequential: bool = False) -> DamianiVolatmeter:
      """
      Damiani Volatmeter
  
      :param candles: np.ndarray
      :param vis_atr: int - default=13
      :param vis_std: int - default=20
      :param sed_atr: int - default=40
      :param sed_std: int - default=100
      :param threshold: float - default=1.4
      :param source_type: str - default: "close"
      :param sequential: bool - default=False
  
      :return: float | np.ndarray
      """
  
      candles = slice_candles(candles, sequential)
  
      source = get_candle_source(candles, source_type=source_type)
  
      atrvis = talib.ATR(candles[:, 3], candles[:, 4], candles[:, 2], timeperiod=vis_atr)
      atrsed = talib.ATR(candles[:, 3], candles[:, 4], candles[:, 2], timeperiod=sed_atr)
  
      vol, t = damiani_volatmeter_fast(source, sed_std, atrvis, atrsed, vis_std, threshold)
  
      if sequential:
          return DamianiVolatmeter(vol, t)
      else:
          return DamianiVolatmeter(vol[-1], t[-1])
  
  
  @njit
  def damiani_volatmeter_fast(source, sed_std, atrvis, atrsed, vis_std,
                              threshold):  # Function is compiled to machine code when called the first time
      lag_s = 0.5
  
      vol = np.full_like(source, 0)
      t = np.full_like(source, 0)
      for i in range(source.shape[0]):
          if not (i < sed_std):
              vol[i] = atrvis[i] / atrsed[i] + lag_s * (vol[i - 1] - vol[i - 3])
              anti_thres = np.std(source[i - vis_std:i]) / np.std(source[i - sed_std:i])
              t[i] = threshold - anti_thres
      return vol, t
   from collections import namedtuple
  
  import numpy as np
  
  from jesse.helpers import get_candle_source, np_shift, slice_candles
  
  AG = namedtuple('AG', ['jaw', 'teeth', 'lips'])
  
  
  def alligator(candles: np.ndarray, source_type: str = "close", sequential: bool = False) -> AG:
      """
      Alligator
  
      :param candles: np.ndarray
      :param source_type: str - default: "close"
      :param sequential: bool - default=False
  
      :return: AG(jaw, teeth, lips)
      """
      candles = slice_candles(candles, sequential)
  
      source = get_candle_source(candles, source_type=source_type)
  
      jaw = np_shift(numpy_ewma(source, 13), 8, fill_value=np.nan)
      teeth = np_shift(numpy_ewma(source, 8), 5, fill_value=np.nan)
      lips = np_shift(numpy_ewma(source, 5), 3, fill_value=np.nan)
  
      if sequential:
          return AG(jaw, teeth, lips)
      else:
          return AG(jaw[-1], teeth[-1], lips[-1])
  
  
  def numpy_ewma(data: np.ndarray, window: int):
      """
  
      :param data:
      :param window:
      :return:
      """
      alpha = 1 / window
      scale = 1 / (1 - alpha)
      n = data.shape[0]
      scale_arr = (1 - alpha) ** (-1 * np.arange(n))
      weights = (1 - alpha) ** np.arange(n)
      pw0 = (1 - alpha) ** (n - 1)
      mult = data * pw0 * scale_arr
      cumsums = mult.cumsum()
      out = cumsums * scale_arr[::-1] / weights.cumsum()
  
      return out
  
apis: numpy.cos numpy.exp numpy.copy
apis: numpy.sin numpy.average numpy.lib.stride_tricks.sliding_window_view
apis: numpy.full_like numpy.std
apis: numpy.arange