Technical Studies Reference


RSI

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 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{MA_t(U(X),n_{RSI})}{MA_t(D(X),n_{RSI})}\right) \right. & MA_t\left(D(X),n_{RSI}\right) \neq 0 \\ RSI_{t - 1}\left(X,n_{RSI}\right) & MA_t\left(D(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: If the value of \(RSI_{t - 1}\) has not been calculated, then a value of \(0\) is used.

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 in terms of a Simple Moving Average for \(t \geq n_{RSI} + n\) as follows.

\(\overline{RSI}_t(X,n_{RSI},n) = MA_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(RSI(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 \(RS_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.

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 Wednesday, 03rd January, 2018.