Technical Studies Reference

Moving Average - Exponential

This study calculates and displays an Exponential Moving Average of 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 Input Length be denoted as \(n\). Then we denote the Moving Average - Exponential at Index \(t\) for the given Inputs as \(EMA_t (X,n)\), and we compute it for \(t \geq n - 1\) as follows.

\(\displaystyle{EMA_t(X,n) = \left\{ \begin{matrix} cX_t + (1 - c)X_{t - 1} & EMA_{t - 1}(X,n) = 0 \\ cX_t + (1 - c)EMA_{t - 1} & EMA_{t - 1}(X,n) \neq 0 \end{matrix}\right .}\)

The constant \(c\) is a Smoothing Constant between \(0\) and \(1\), and is related to the Input Length via \(c = \frac{2}{n+1}\).

Note: For the purposes of computing \(EMA_t(X,n)\) for \(t \geq n - 1\), we use the following internal calculations for \(1 \leq t < n -1\). These values are not returned as output.

\(\displaystyle{EMA_t(X,n) = \left\{\begin{matrix} \left(\frac{2}{t + 2}\right)X_t + \left(1 - \frac{2}{t + 2}\right)X_{t - 1} & EMA_{t - 1}(X,n) = 0 \\ \left(\frac{2}{t + 2}\right)X_t + \left(1 - \frac{2}{t + 2}\right)EMA_{t - 1} & EMA_{t - 1}(X,n) \neq 0 \end{matrix}\right .}\)

The higher the setting for the Length Input, the increase in sensitivity with the exponential moving average calculation to past values, as the amount of historical data in the chart changes. Even bar values which are outside the range of bars used in the calculation have an effect upon the exponential moving average values. The exponential moving average calculation uses the prior exponential value in its calculation, and so prior values have a continuous effect going back all the way to the first bar in the chart.

Therefore, merely by changing the Chart >> Chart Settings >> Use Number of Days to Load >> Days to Load, for a long Length exponential moving average will alter the result at a particular chart column even though the days removed or loaded in the chart is prior to the exponential moving average value at a particular chart column going back by the number of bars specified by the Length Input.

This is something important understand about the nature of the exponential calculation and you should question as to whether it is even an appropriate calculation method for your method of analysis. The exponential moving average should not be used with long Lengths. Instead use Moving Average - Simple.



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.


*Last modified Wednesday, 03rd January, 2018.