Skip to content

TSI #

TSI #

TSI(
    fast_period: int,
    slow_period: int,
    input_values: List[float] = None,
    input_indicator: Indicator = None,
    input_modifier: InputModifierType = None,
    ma_type: MAType = MAType.EMA,
    input_sampling: SamplingPeriodType = None,
)

Bases: Indicator

True Strength Index.

Input type: float

Output type: float

Parameters:

Name Type Description Default
fast_period int

Fast moving average period.

required
slow_period int

Slow 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.

EMA
input_sampling SamplingPeriodType

Input sampling type.

None
Source code in talipp/indicators/TSI.py
def __init__(self, fast_period: int,
             slow_period: int,
             input_values: List[float] = None,
             input_indicator: Indicator = None,
             input_modifier: InputModifierType = None,
             ma_type: MAType = MAType.EMA,
             input_sampling: SamplingPeriodType = None):
    super().__init__(input_modifier=input_modifier,
                     input_sampling=input_sampling)

    self.slow_ma = MAFactory.get_ma(ma_type, slow_period)
    self.add_managed_sequence(self.slow_ma)
    self.fast_ma = MAFactory.get_ma(ma_type, fast_period, input_indicator = self.slow_ma)

    self.abs_slow_ma = MAFactory.get_ma(ma_type, slow_period)
    self.add_managed_sequence(self.abs_slow_ma)
    self.abs_fast_ma = MAFactory.get_ma(ma_type, fast_period, input_indicator = self.abs_slow_ma)

    self.initialize(input_values, input_indicator)