Login Page - Create Account

Technical Studies Reference


RSI


Description

This study calculates the Welles Wilder Relative Strength Index (RSI) of the data specified by the Input Data Input. The study also calculates a Moving Average of the RSI. It displays graphs of both of these functions, in addition to two horiztonal lines, which are specified by the Inputs Line1 Value and Line2 Value. Both the RSI and the Moving Average of the RSI have an associated Length Input: RSI Length \(n_{RSI}\) and RSI Moving Average Length \(n\), respectively.

Let \(X\) be a random variable denoting the Input Data, and let \(X_t\) be the value of the Input Data at Index \(t\). Then we denote the Upward Change and Downward Change in \(X\) at Index \(t\) as \(U_t(X)\) and \(D_t(X)\), respectively. We compute these for \(t > 0\) as follows.

\(\displaystyle{U_t(X) =\left\{ \begin{matrix} X_t - X_{t - 1} & X_t > X_{t - 1} \\ 0 & X_t \leq X_{t - 1} \end{matrix}\right .}\)

\(\displaystyle{D_t(X) =\left\{ \begin{matrix} 0 & X_t > X_{t - 1} \\ X_{t - 1} - X_t & X_t \leq X_{t - 1} \end{matrix}\right .}\)

The Relative Strength Index at Index \(t\) is denoted as \(RSI_t\left(X,n_{RSI}\right)\), and it is computed in terms of a Simple Moving Average for \(t \geq n_{RSI} + n\) as follows.

\(\displaystyle{RSI_t\left(X,n_{RSI}\right) =\left\{ \begin{matrix} 100 - \left. 100 \middle/ \left(1+ \frac{SMA_t(U(X),n_{RSI})}{SMA_t(D(X),n_{RSI})}\right) \right. & SMA_t\left(D(X),n_{RSI}\right) \neq 0 \\ 100 & SMA_t\left(D(X),n_{RSI}\right) = 0 \space and \space SMA_t\left(U(X),n_{RSI}\right) \neq 0 \\ 0 & SMA_t\left((U(X),n_{RSI}\right) = 0 \end{matrix}\right .}\)

In the above formula, \(U(X)\) and \(D(X)\) are random variables denoting the Upward and Downward Changes in \(X\), respectively.

Note: For the purposes of computing \(RSI_t\left(X,n_{RSI}\right)\) for \(t \geq n_{RSI} + n\), we use internal calculations for \(n_{RSI} - 1 \leq t < n_{RSI} + n\) using the last formula given above. These values are not returned as output.

The Moving Average of \(RSI_t\left(X,n_{RSI}\right)\) with Length RSI Moving Average Length \(n\) at Index \(t\) is denoted as \(\overline{RSI}_t(X,n_{RSI},n)\). This Moving Average is calculated for \(t \geq n_{RSI} + n\) as follows.

\(\overline{RSI}_t(X,n_{RSI},n) = SMA_t(RSI(X,n_{RSI}),n)\)

In the above formula, \(RSI(X,n_{RSI})\) is a random variable denoting the RSI of \(X\) with Length \(n\).

Note: For the purposes of computing \(\overline{RSI}_t(X,n_{RSI},n)\) for \(t \geq n_{RSI} + n\), we use internal calculations for \(n_{RSI} +n - 2 \leq t < n_{RSI} + n\) using the last formula given above. These values are not returned as output.

Note: Depending on the setting of the Input Average Type, the Simple Moving Averages in the calculations of \(RSI_t\left(X,n_{RSI}\right)\) and \(\overline{RSI}_t(RSI(X,n_{RSI}),n)\) could be replaced with Exponential Moving Averages, Linear Regression Moving Averages, Weighted Moving Averages, Wilders Moving Averages, Simple Moving Averages - Skip Zeros, or Smoothed Moving Averages. The types of all three Moving Averages in the calculation are determined by this one Input.

If the Input Use RSI - 50 is set to Yes, then 50 is subtracted from the values of the RSI, the Moving Average of the RSI, Line 1 Value, and Line 2 value.

Inputs

Spreadsheet

The spreadsheet below contains the formulas for this study in Spreadsheet format. Save this Spreadsheet to the Data Files Folder.

Open it through File >> Open Spreadsheet.

RSI.38.scss


*Last modified Monday, 27th February, 2023.