Relative Strength Index
RSI measures the speed and change of price movements.
Method
tm.ta.rsi(source, timeperiod)
Inputs
Parameter | Argument type | Description | Default Value |
---|---|---|---|
source | pd.Series | Input data series | - |
timeperiod | int | Number of periods for the indicator | 14 |
Outputs
Output | Type |
---|---|
rsi | np.ndarray |
Example usage
import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Relative Strength Index rsi = tm.ta.rsi(data.close, timeperiod=14)
# Get the last value and print last_value = rsi.iloc[-1] tm.log(f"Last value of Relative Strength Index is {last_value}")
# Plot the values of rsi tm.plot(rsi, title="Relative Strength Index", overlay=False)