# 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.optionalpha.com/technical-documentation/indicators/rsi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
