Technical Studies Reference

Moving Average - Simple Skip Zeros

This study calculates and displays a Simple Moving Average of the data specified by the Input Data Input, excluding the values that are equal to zero.

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 Input Length be denoted as \(n\), and let the number of nonzero values of \(X\) from \(X_{t-n+1}\) through \(X_t\) be denoted as \(n_{NZ}\). Then we denote the Moving Average - Simple Skip Zeros at Index \(t\) for the given Inputs as \(SZMA_t(X,n)\), and we compute it for \(t \geq n - 1\) as follows.

\(\displaystyle{SZMA_t(X,n) =\left\{ \begin{matrix} \left. \left(\sum_{i = t - n + 1}^tX_i\right) \middle/ n_{NZ}\right. & n_{NZ} \neq 0 \\ 0 & n_{NZ} = 0 \end{matrix}\right .}\)

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


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.