# Cumulative Weighted Moving Average Calculator

Given a list of sequential data, you can construct a cumulative weighted moving average by finding the weighted average of all the points up to the current point. For example, suppose you have the ordered data set

20, 18, 16, 16, 14, 10, 8, 4

and you apply weights that grow quadratically as the terms increase in number. That is, the weighting vectors are successively [1], [1, 4], [1, 4, 9], ... ect, where 1 is applied to the oldest term and *j*² is applied to the *j*^{th} term. Then the quadratically weighted cumulative moving average is

20, 18.4, 16.857, 16.4, 15.309, 13.209, 11.386, 9.069

Cumulative weighted moving averages are used to "smooth" sequential, giving more significance to more recent data points while not completely discounting older data. The calculator below computes linearly, quadratically, and cubically weighted cumulative averages. Stock analysts often calculate another kind of cumulative weighted moving average, the Exponential Moving Average (EMA), in which the weights decrease exponentially.

#### Recursive Formulas for Linear, Quadratic, and Cubic Weighted Cumulative Moving Averages

Suppose the original set of ordered data is {x_{1}, x

_{2},...,x

_{n}}. If {L

_{1}, L

_{2},..., L

_{n}} is the set of linearly weighted cumulative averages, then L

_{i}can be calculated with the recursion

L

_{1}= x

_{1}

L

_{i+1}= [2/(i+2)]x

_{i+1}+ [i/(i+2)]L

_{i}

If {Q

_{1}, Q

_{2},..., Q

_{n}} and {C

_{1}, C

_{2},..., C

_{n}} are the quadratic and cubic weighted cumulative averages, then they can also be computed recursively:

Q

_{1}= x

_{1}

Q

_{i+1}= [(6i+6)/(2i²+7i+6)]x

_{i+1}+ [(2i²+i)/(2i²+7i+6)]Q

_{i}

C

_{1}= x

_{1}

C

_{i+1}= [(4i+4)/(i²+4i+4)]x

_{i+1}+ [(i²)/(i²+4i+4)]C

_{i}

©

*Had2Know 2010*