Technical Studies Reference


Moving Average - Smoothed

This study calculates and displays a smoothed moving average of the data specified by the Input Data Input.

Let \(X\) be a random variable denoting the Input Data, and let \(X_i\) be the value of the Input Data at Index \(i\). Let the Inputs Length and Offset be denoted as \(n\) and \(k\), respectively. Then we denote the Moving Average - Smoothed at chart bar \(t\) for the given Inputs as \(SMMA_t(X,n,k)\), and we compute it for \(t \geq 0\) as follows.

For \(t = 0\): \(SMMA_0(X,n,k) = X_0\)

For \(t > 0\) the calculation may involve Simple Moving Averages, as shown below.

For \(0 < t \leq k + 1\):

\(\displaystyle{SMMA_t(X,k,n) = \left\{\begin{matrix} \frac{1}{n}(nX_0 - SMMA_{t - 1}(X,n,k) + X_{t - k}) & SMMA_{t - 1}(X,n,k) \neq 0 \\ MA_{t - k - 1}(X,n) & SMMA_{t - 1}(X,n,k) = 0 \end{matrix}\right .}\)

For \(k + 1 < t < n + k\):

\(\displaystyle{SMMA_t(X,n,k) = \left\{\begin{matrix} \frac{1}{n}\left((n - t + k + 1)X_0 + \sum_{i = 1}^{t - k - 1}X_i - SMMA_{t - 1}(X,n,k) + X_{t - k}\right) & SMMA_{t - 1}(X,n,k) \neq 0 \\ MA_{t - k - 1}(X,n) & SMMA_{t - 1}(X,n,k) = 0 \end{matrix}\right .}\)

For \(t \geq n + k\):

\(\displaystyle{SMMA_t(X,n,k) = \left\{\begin{matrix} \frac{1}{n}\left(\sum_{i = t - k - n}^{t - k - 1}X_i - SMMA_{t - 1}(X,n,k) + X_{t - k}\right) & SMMA_{t - 1}(X,n,k) \neq 0 \\ MA_{t - k - 1}(X,n) & SMMA_{t - 1}(X,n,k) = 0 \end{matrix}\right .}\)

For an explanation of the Sigma (\(\Sigma\)) notation for summation, refer to the Wikipedia article Summation.

Inputs

  • Input Data
  • Length
  • Offset: This Input specifies the number of chart bars by which the summation index is to be shifted forward.

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.

Moving_Average_-_Smoothed.173.scss


*Last modified Wednesday, 18th April, 2018.