# Technical Studies Reference

This study calculates and displays an Adaptive Moving Average of the data specified by the Input Data Input. This moving average was developed by Perry Kaufman. Reference: Stocks & Commodities V13:6: (267): Sidebar: Adaptive Moving Average.

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 Fast Smoothing Constant and Slow Smoothing Constant be denoted as $$c_F$$ and $$c_S$$, respectively, and let the Input Length be denoted as $$n$$. We denote the values of the Direction, Volatility, and Smoothing Constant for the given Inputs at Index $$t$$ as $$Dir_t(X,n)$$, $$Vol_t(X,n)$$, and $$c_t(X,n)$$, respectively. We compute these for $$t \geq n$$ as follows.

$$Dir_t(X,n) = X_t - X_{t-n}$$

$$\displaystyle{Vol_t(X,n) = \left\{ \begin{matrix} 0.000001 & \sum_{i=t-n+1}^t\left|X_i - X_{i-1}\right| = 0 \\ \sum_{i=t-n+1}^t\left|X_i - X_{i-1}\right| & \sum_{i=t-n+1}^t\left|X_i - X_{i-1}\right| \neq 0 \end{matrix}\right .}$$

$$\displaystyle{c_t(X,n) = \left[\left|\frac{Dir_t(X,n)}{Vol_t(X,n)}\right|\left(\frac{2}{c_F + 1} - \frac{2}{c_S + 1}\right) + \frac{2}{c_S + 1}\right]^2}$$

We denote the Moving Average - Adaptive at Index $$t$$ for the given Inputs as $$AMA_t\left(X,n,c_F,c_S\right)$$, and we compute it with the following recursion relation for $$t \geq n$$.

$$\displaystyle{AMA_t\left(X,n,c_F,c_S\right) = \left\{ \begin{matrix} X_{t-1} + c_t(X,n)\cdot\left(X_t - X_{t - 1}\right) & AMA_{t-1}\left(X,n,c_F,c_S\right) = 0 \\ AMA_{t-1}\left(X,n,c_F,c_S\right) + c_t(X,n)\cdot(X_t - AMA_{t-1}\left(X,n,c_F,c_S\right)) & AMA_{t-1}\left(X,n,c_F,c_S\right) \neq 0 \end{matrix}\right.}$$

For an explanation of the Sigma ($$\Sigma$$) notation for summation, refer to our description here.