> For the complete documentation index, see [llms.txt](https://docs.optionalpha.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.optionalpha.com/technical-documentation/indicators/rsi.md).

# RSI

## RSI

The relative strength index (RSI) is a technical indicator of momentum that measures the speed and change of price on a scale of 0 to 100, typically over the past 14 periods. Readings over 70 are considered overbought while readings below 30 are considered oversold.

The source code for the RSI function is available [here](https://app.optionalpha.com/ta/RSI.txt).

```
/* Often documentation present the RSI calculation as follow:
 *    RSI = 100 - (100 / 1 + (prevGain/prevLoss))
 *
 * The following is equivalent:
 *    RSI = 100 * (prevGain/(prevGain+prevLoss))
 *
 * The second equation is used here for speed optimization.
 */
```

<br>
