Lean  $LEAN_TAG$
QuantConnect.Indicators.TrueStrengthIndex Class Reference

This indicator computes the True Strength Index (TSI). The True Strength Index is calculated as explained here: https://school.stockcharts.com/doku.php?id=technical_indicators:true_strength_index More...

Inheritance diagram for QuantConnect.Indicators.TrueStrengthIndex:
[legend]

Public Member Functions

 TrueStrengthIndex (int longTermPeriod=25, int shortTermPeriod=13, int signalPeriod=7, MovingAverageType signalType=MovingAverageType.Exponential)
 Initializes a new instance of the TrueStrengthIndex class using the specified short and long term smoothing periods, and the signal period and type. More...
 
 TrueStrengthIndex (string name, int longTermPeriod=25, int shortTermPeriod=13, int signalPeriod=7, MovingAverageType signalType=MovingAverageType.Exponential)
 Initializes a new instance of the TrueStrengthIndex class using the specified name, the short and long term smoothing periods, and the signal period and type. More...
 
override void Reset ()
 Resets this indicator to its initial state More...
 

Public Attributes

override bool IsReady => Samples >= WarmUpPeriod
 Gets a flag indicating when this indicator is ready and fully initialized More...
 

Protected Member Functions

override decimal ComputeNextValue (IndicatorDataPoint input)
 Computes the next value of this indicator from the given state More...
 
- Protected Member Functions inherited from QuantConnect.Indicators.Indicator
 Indicator (string name)
 Initializes a new instance of the Indicator class using the specified name. More...
 

Properties

IndicatorBase< IndicatorDataPointSignal [get]
 Gets the signal line for the TSI indicator More...
 
int WarmUpPeriod [get]
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 
- Properties inherited from QuantConnect.Indicators.Indicator
static int DefaultWindowSize = 2 [get]
 The default size of the history window for the indicator More...
 
- Properties inherited from QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider
int WarmUpPeriod [get]
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 

Detailed Description

This indicator computes the True Strength Index (TSI). The True Strength Index is calculated as explained here: https://school.stockcharts.com/doku.php?id=technical_indicators:true_strength_index

Briefly, the calculation has three steps:

  1. Smooth the momentum and the absolute momentum by getting an EMA of them (typically of period 25)
  2. Double smooth the momentum and the absolute momentum by getting an EMA of their EMA (typically of period 13)
  3. The TSI formula itself: divide the double-smoothed momentum over the double-smoothed absolute momentum and multiply by 100

The signal is typically a 7-to-12-EMA of the TSI.

Definition at line 31 of file TrueStrengthIndex.cs.

Constructor & Destructor Documentation

◆ TrueStrengthIndex() [1/2]

QuantConnect.Indicators.TrueStrengthIndex.TrueStrengthIndex ( int  longTermPeriod = 25,
int  shortTermPeriod = 13,
int  signalPeriod = 7,
MovingAverageType  signalType = MovingAverageType.Exponential 
)

Initializes a new instance of the TrueStrengthIndex class using the specified short and long term smoothing periods, and the signal period and type.

Parameters
shortTermPeriodPeriod used for the first price change smoothing
longTermPeriodPeriod used for the second (double) price change smoothing
signalPeriodThe signal period
signalTypeThe type of moving average to use for the signal

Definition at line 67 of file TrueStrengthIndex.cs.

◆ TrueStrengthIndex() [2/2]

QuantConnect.Indicators.TrueStrengthIndex.TrueStrengthIndex ( string  name,
int  longTermPeriod = 25,
int  shortTermPeriod = 13,
int  signalPeriod = 7,
MovingAverageType  signalType = MovingAverageType.Exponential 
)

Initializes a new instance of the TrueStrengthIndex class using the specified name, the short and long term smoothing periods, and the signal period and type.

Parameters
nameThe name of the indicator
shortTermPeriodPeriod used for the first price change smoothing
longTermPeriodPeriod used for the second (double) price change smoothing
signalPeriodThe signal period
signalTypeThe type of moving average to use for the signal

Definition at line 80 of file TrueStrengthIndex.cs.

Member Function Documentation

◆ ComputeNextValue()

override decimal QuantConnect.Indicators.TrueStrengthIndex.ComputeNextValue ( IndicatorDataPoint  input)
protected

Computes the next value of this indicator from the given state

Parameters
inputThe input given to the indicator
Returns
A new value for this indicator

Definition at line 97 of file TrueStrengthIndex.cs.

◆ Reset()

override void QuantConnect.Indicators.TrueStrengthIndex.Reset ( )

Resets this indicator to its initial state

Definition at line 116 of file TrueStrengthIndex.cs.

Member Data Documentation

◆ IsReady

override bool QuantConnect.Indicators.TrueStrengthIndex.IsReady => Samples >= WarmUpPeriod

Gets a flag indicating when this indicator is ready and fully initialized

Definition at line 58 of file TrueStrengthIndex.cs.

Property Documentation

◆ Signal

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.TrueStrengthIndex.Signal
get

Gets the signal line for the TSI indicator

Definition at line 48 of file TrueStrengthIndex.cs.

◆ WarmUpPeriod

int QuantConnect.Indicators.TrueStrengthIndex.WarmUpPeriod
get

Required period, in data points, for the indicator to be ready and fully initialized.

Definition at line 53 of file TrueStrengthIndex.cs.


The documentation for this class was generated from the following file: