Stochastic Relative Strength Index
STOCHRSI combines elements of Stochastic and RSI to identify overbought and oversold conditions.
Method
Section titled “Method”tm.ta.stochrsi(source, timeperiod, fastk_period, fastd_period, fastd_matype)Inputs
Section titled “Inputs”| Parameter | Argument type | Description | Default Value |
|---|---|---|---|
| source | pd.Series | Input data series | - |
| timeperiod | int | Number of periods for the indicator | 14 |
| fastk_period | int | Fast %K period for the indicator | 5 |
| fastd_period | int | Fast %D period for the indicator | 3 |
| fastd_matype | int | Fast %D Moving Average type | 0 |
Outputs
Section titled “Outputs”| Output | Type |
|---|---|
| fastk | np.ndarray |
| fastd | np.ndarray |
Example usage
Section titled “Example usage”import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Stochastic Relative Strength Index fastk, fastd = tm.ta.stochrsi(data.close, timeperiod=14, fastk_period=5, fastd_period=3, fastd_matype=0)
# Get the last value and print last_value = fastk.iloc[-1] tm.log(f"Last value of Stochastic Relative Strength Index is {last_value}")
# Plot the values of fastk tm.plot(fastk, title="Stochastic Relative Strength Index", overlay=False)