RSI Indicator¶
rsi
¶
RSI (Relative Strength Index) calculation module.
Public API
compute_rsi(close: pd.Series, period: int = 14) -> pd.Series
compute_rsi(close, period=14)
¶
Compute Relative Strength Index (RSI).
RSI = 100 - (100 / (1 + RS)) where RS = Average Gain / Average Loss.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
close
|
Series
|
Series of closing prices. |
required |
period
|
int
|
Lookback period length (must be >=1, default 14). |
14
|
Returns:
| Type | Description |
|---|---|
Series
|
Series of RSI values in range [0,100]. NaN values where insufficient history. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/stockcharts/indicators/rsi.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |