RSI
Summary
Wilder's Relative Strength Index, a momentum oscillator bounded 0-100 from the ratio of average gains to average losses over the period. Used to gauge overbought/oversold conditions. >70 overbought, <30 oversold.
Formula
Initial avgGain/avgLoss = simple mean of up/down moves over the period, then Wilder-smoothed each bar: \(avg = (avg_{prev}\cdot(period-1) + move)/period\). \(RSI = 100\cdot avgGain/(avgGain+avgLoss)\) (equivalent to \(100 - 100/(1+RS)\)).
Notes
- In Metastock-compatibility mode an extra initial value is emitted, treating the first bar as having no gain or loss.
Inputs
inReal— Price series (typically close)
Outputs
outReal— RSI value
Parameters
optInTimePeriod— Lookback for the gain/loss averaging
Implementation
TA-Lib Definition: rsi.c · rsi.yaml
| Native | File |
|---|---|
| C | ta_RSI.c |
| Rust | rsi.rs |
| Java | Core.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
relative strength index
See Also
References
- J. Welles Wilder, New Concepts in Technical Trading Systems, Trend Research (ISBN 0894590278)