Class TripleExponentialMovingAverageOscillator
Import
from NitroFE import TripleExponentialMovingAverageOscillator

The Triple Exponential Moving Average Oscillator calculates the rate of change of Triple Exponential Moving Average
Methods
__init__(self, com=None, operation='mean', initialize_using_operation=False, initialize_span=None, span=None, halflife=None, alpha=None, min_periods=0, ignore_na=False, axis=0, times=None)
  
      special
  
    Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| alpha | float | Specify smoothing factor directly, by default None | None | 
| operation | str | operation to be performed for the moving feature,available operations are 'mean','var','std', by default 'mean' | 'mean' | 
| initialize_using_operation | bool | If True, then specified 'operation' is performed on the first 'initialize_span' values, and then the exponential moving average is calculated, by default False | False | 
| initialize_span | int | the span over which 'operation' would be performed for initialization, by default None | None | 
| com | float | Specify decay in terms of center of mass, by default None | None | 
| span | float | pecify decay in terms of span , by default None | None | 
| halflife | float | Specify decay in terms of half-life, by default None | None | 
| min_periods | int | Minimum number of observations in window required to have a value (otherwise result is NA)., by default 0 | 0 | 
| ignore_na | bool | Ignore missing values when calculating weights; specify True to reproduce pre-0.15.0 behavior, by default False | False | 
| axis | int | The axis to use. The value 0 identifies the rows, and 1 identifies the columns, by default 0 | 0 | 
| times | str | Times corresponding to the observations. Must be monotonically increasing and datetime64[ns] dtype, by default None | None | 
Source code in nitrofe\time_based_features\indicator_features\_tripleexponentialmovingaverageoscillator.py
          def __init__(
    self,
    com: float = None,
    operation: str = "mean",
    initialize_using_operation: bool = False,
    initialize_span: int = None,
    span: float = None,
    halflife: float = None,
    alpha: float = None,
    min_periods: int = 0,
    ignore_na: bool = False,
    axis: int = 0,
    times: str = None,
):
    """
    Parameters
    ----------
    alpha : float, optional
        Specify smoothing factor  directly, by default None
    operation : str, {'mean','var','std'}
        operation to be performed for the moving feature,available operations are 'mean','var','std', by default 'mean'
    initialize_using_operation : bool, optional
        If True, then specified 'operation' is performed on the first 'initialize_span' values, and then the exponential moving average is calculated, by default False
    initialize_span : int, optional
        the span over which 'operation' would be performed for initialization, by default None
    com : float, optional
        Specify decay in terms of center of mass, by default None
    span : float, optional
        pecify decay in terms of span , by default None
    halflife : float, optional
        Specify decay in terms of half-life, by default None
    min_periods : int, optional
        Minimum number of observations in window required to have a value (otherwise result is NA)., by default 0
    ignore_na : bool, optional
        Ignore missing values when calculating weights; specify True to reproduce pre-0.15.0 behavior, by default False
    axis : int, optional
        The axis to use. The value 0 identifies the rows, and 1 identifies the columns, by default 0
    times : str, optional
        Times corresponding to the observations. Must be monotonically increasing and datetime64[ns] dtype, by default None
    """
    self.com = com
    self.span = span
    self.halflife = halflife
    self.alpha = alpha
    self.min_periods = min_periods
    self.ignore_na = ignore_na
    self.axis = axis
    self.times = times
    self.operation = operation
    self.initialize_using_operation = initialize_using_operation
    self.initialize_span = initialize_span
fit(self, dataframe, first_fit=True)
    For your training/initial fit phase (very first fit) use fit_first=True, and for any production/test implementation pass fit_first=False
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| dataframe | Union[pandas.core.frame.DataFrame, pandas.core.series.Series] | dataframe containing column values to create feature over | required | 
| first_fit | bool | Indicator features require past values for calculation. Use True, when calculating for training data (very first fit) Use False, when calculating for subsequent testing/production data { in which case the values, which were saved during the last phase, will be utilized for calculation }, by default True | True | 
Source code in nitrofe\time_based_features\indicator_features\_tripleexponentialmovingaverageoscillator.py
          def fit(
    self,
    dataframe: Union[pd.DataFrame, pd.Series],
    first_fit: bool = True,
):
    """
    For your training/initial fit phase (very first fit) use fit_first=True, and for any production/test implementation pass fit_first=False
    Parameters
    ----------
    dataframe : Union[pd.DataFrame, pd.Series]
        dataframe containing column values to create feature over
    first_fit : bool, optional
        Indicator features require past values for calculation.
        Use True, when calculating for training data (very first fit)
        Use False, when calculating for subsequent testing/production data { in which case the values, which
        were saved during the last phase, will be utilized for calculation }, by default True
    """
    if first_fit:
        self._osc_object = TripleExponentialMovingFeature(
            com=self.com,
            operation=self.operation,
            span=self.span,
            halflife=self.halflife,
            alpha=self.alpha,
            min_periods=self.min_periods,
            ignore_na=self.ignore_na,
            axis=self.axis,
            initialize_using_operation=self.initialize_using_operation,
            initialize_span=self.initialize_span,
            times=self.times,
        )
        self._difference_object = weighted_window_features()
    res = self._osc_object.fit(dataframe=dataframe, first_fit=first_fit)
    res = self._difference_object._template_feature_calculation(
        function_name="triple_exponential_moving_average_oscillator",
        win_function=_identity_window,
        first_fit=first_fit,
        dataframe=res,
        window=2,
        min_periods=None,
        symmetric=None,
        operation=self._ocs_value,
        operation_args=(),
    )
    return res
References
- investopedia, "triple-exponential-moving-average", https://www.investopedia.com/terms/t/triple-exponential-moving-average.asp