# 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, 4], [1, 4, 9], ... ect, where 1 is applied to the oldest term and j² is applied to the jth 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.

 Enter comma-separated data here. DO NOT end list with a comma. Type of Cumulative Weight: LinearQuadraticCubic Cumulative weighted moving average will be output here.

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

Suppose the original set of ordered data is {x1, x2,...,xn}. If {L1, L2,..., Ln} is the set of linearly weighted cumulative averages, then Li can be calculated with the recursion

L1 = x1
Li+1 = [2/(i+2)]xi+1 + [i/(i+2)]Li

If {Q1, Q2,..., Qn} and {C1, C2,..., Cn} are the quadratic and cubic weighted cumulative averages, then they can also be computed recursively:

Q1 = x1
Qi+1 = [(6i+6)/(2i²+7i+6)]xi+1 + [(2i²+i)/(2i²+7i+6)]Qi

C1 = x1
Ci+1 = [(4i+4)/(i²+4i+4)]xi+1 + [(i²)/(i²+4i+4)]Ci