# Relative Momentum Index

This study calculates and displays a Relative Momentum Index for the data specified by the Input Data Input.

Let $$X$$ be a random variable denoting the Input Data, and let $$X_t$$ be the value of the Input Data at Index $$t$$. Let the Inputs RMI Length and RMI Moving Average Length be denoted as $$n$$ and $$n_{MA}$$, respectively. Then we denote the Upward Change and Downward Change in $$X$$ over $$n$$ periods at Index $$t$$ as $$U_t(X,n)$$ and $$D_t(X,n)$$, respectively. We compute these for $$t \geq 0$$ as follows.

For $$0 \leq t < n$$:

$$\displaystyle{U_t(X,n) =\left\{ \begin{matrix} X_t - X_0 & X_t > X_0 \\ 0 & X_t \leq X_0 \end{matrix}\right .}$$

$$\displaystyle{D_t(X,n) =\left\{ \begin{matrix} 0 & X_t > X_0 \\ X_0 - X_t & X_t \leq X_0 \end{matrix}\right .}$$

For $$t \geq n$$:

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

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

We denote the Relative Momentum Index at Index $$t$$ for the given Inputs as $$RMI_t(X,n,n_{MA})$$. At $$t = \max\{n,n_{MA}\} - 1$$ we initialize the RMI to zero, and for $$t \geq \max\{n,n_{MA}\}$$ we compute it in terms of Simple Moving Averages as follows.

$$\displaystyle{RMI_t(X,n,n_{MA}) =\left\{ \begin{matrix} 100\cdot\frac{SMA_t(U(X,n),n_{MA})}{SMA_t(U(X,n),n_{MA}) + SMA_t(D(X,n),n_{MA})} & SMA_t(U(X,n),n_{MA}) + SMA_t(D(X,n),n_{MA}) \neq 0 \\ RMI_{t - 1}(X,n,n_{MA}) & SMA_t(U(X,n),n_{MA}) + SMA_t(D(X,n),n_{MA}) = 0\end{matrix}\right .}$$

Note: Depending on the setting of the RMI Moving Average Type Input, the Simple Moving Averages in the above formula 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.

This study also displays three horizontal lines at levels determined by the Overbought Value, Oversold Value, and Midline Value Inputs.