Skip to content

StochRSI #

StochRSI #

StochRSI(
    rsi_period: int,
    stoch_period: int,
    k_smoothing_period: int,
    d_smoothing_period: int,
    input_values: List[float] = None,
    input_indicator: Indicator = None,
    input_modifier: InputModifierType = None,
    ma_type: MAType = MAType.SMA,
    input_sampling: SamplingPeriodType = None,
)

Bases: Indicator

Stochastic RSI.

Input type: float

Output type: StochRSIVal

Parameters:

Name Type Description Default
rsi_period int

RSI period.

required
stoch_period int

Stoch period.

required
k_smoothing_period int

Stoch's k moving average period.

required
d_smoothing_period int

Stoch's d moving average period.

required
input_values List[float]

List of input values.

None
input_indicator Indicator

Input indicator.

None
input_modifier InputModifierType

Input modifier.

None
ma_type MAType

Moving average type.

SMA
input_sampling SamplingPeriodType

Input sampling type.

None
Source code in talipp/indicators/StochRSI.py
def __init__(self, rsi_period: int,
             stoch_period: int,
             k_smoothing_period: int,
             d_smoothing_period: int,
             input_values: List[float] = None,
             input_indicator: Indicator = None,
             input_modifier: InputModifierType = None,
             ma_type: MAType = MAType.SMA,
             input_sampling: SamplingPeriodType = None):
    super().__init__(input_modifier=input_modifier,
                     output_value_type=StochRSIVal,
                     input_sampling=input_sampling)

    self.stoch_period = stoch_period

    self.rsi = RSI(rsi_period)
    self.add_sub_indicator(self.rsi)

    self.smoothed_k = MAFactory.get_ma(ma_type, k_smoothing_period)
    self.add_managed_sequence(self.smoothed_k)

    self.values_d = MAFactory.get_ma(ma_type, d_smoothing_period)
    self.add_managed_sequence(self.values_d)

    self.initialize(input_values, input_indicator)

StochRSIVal dataclass #

StochRSIVal(k: float = None, d: float = None)

StochRSI output type.

Parameters:

Name Type Description Default
k float

k value.

None
d float

d value.

None