Class InverseFisherRelativeStrengthIndex
Import
from NitroFE import InverseFisherRelativeStrengthIndex
Inverse Fisher Relative Strength Index is calculated as (IFRSI)
For your training/initial fit phase (very first fit) use fit_first=True, and for any production/test implementation pass fit_first=False
Methods
__init__(self, lookback_period=8, lookback_for_inverse_fisher=8)
special
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lookback_period |
int |
Size of the rolling window for lookback, by default 8 |
8 |
lookback_for_inverse_fisher |
int |
Size of the rolling window for lookback for weighted moving average of rsi, by default 8 |
8 |
Source code in nitrofe\time_based_features\indicator_features\_inversefisherrelativestrengthindex.py
def __init__(self, lookback_period: int = 8, lookback_for_inverse_fisher: int = 8):
"""
Parameters
----------
lookback_period : int, optional
Size of the rolling window for lookback, by default 8
lookback_for_inverse_fisher : int, optional
Size of the rolling window for lookback for weighted moving average of rsi, by default 8
"""
self.lookback_period = lookback_period
self.lookback_for_inverse_fisher = lookback_for_inverse_fisher
fit(self, dataframe, first_fit=True)
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\_inversefisherrelativestrengthindex.py
def fit(self, dataframe: Union[pd.DataFrame, pd.Series], first_fit: bool = True):
"""
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._rsi_object = RelativeStrengthIndex(
lookback_period=self.lookback_period
)
self._ww_object = weighted_window_features()
rsi_value = self._rsi_object.fit(dataframe, first_fit=first_fit)
rsi_value = 0.1 * (rsi_value - 50)
rsi_value = self._ww_object.caluclate_weighted_moving_window_feature(
dataframe=rsi_value,
first_fit=first_fit,
window=self.lookback_for_inverse_fisher,
operation=np.sum,
)
rsi_value = (np.exp(2 * rsi_value) - 1) / (np.exp(2 * rsi_value) + 1)
return rsi_value
References
- traders, "A Smoothed Rsi Inverse Fisher Transform", http://traders.com/Documentation/FEEDbk_docs/2010/10/Vervoort.html