In a cumulative moving average, the data arrive in an ordered datum stream and the statistician would like to get the average of all of the data up until the current datum point. For example, an investor may want the average price of all of the stock transactions for a particular stock up until the current time. As each new transaction occurs, the average price at the time of the transaction can be calculated for all of the transactions up to that point using the cumulative average, typically an unweighted average of the sequence of i values x1, ..., xi up to the current time:
The brute-force method to calculate this would be to store all of the data and calculate the sum and divide by the number of datum points every time a new datum point arrived. However, it is possible to simply update cumulative average as a new value xi+1 becomes available, using the formula:
where can be taken to be equal to 0.
Thus the current cumulative average for a new datum point is equal to the previous cumulative average plus the difference between the latest datum point and the previous average divided by the number of points received so far. When all of the datum points arrive (i = N), the cumulative average will equal the final average.
The derivation of the cumulative average formula is straightforward. Using
and similarly for i + 1, it is seen that
Solving this equation for CAi+1 results in:
Read more about this topic: Moving Average (technical Analysis)
Famous quotes containing the words cumulative, moving and/or average:
“Raising children is an incredibly hard and risky business in which no cumulative wisdom is gained: each generation repeats the mistakes the previous one made.”
—Bill Cosby (20th century)
“His moving impulse is no flabby yearning to teach, to expound, to make simple; it is that obscure inner necessity of which Conrad tells us, the irresistible creative passion of a genuine artist, standing spell-bound before the impenetrable enigma that is life, enamoured by the strange beauty that plays over its sordidness, challenged to a wondering and half-terrified sort of representation of what passes understanding.”
—H.L. (Henry Lewis)
“Whether or not his newspaper and a set of senses reduced to five are the main sources of the so-called real life of the so- called average man, one thing is fortunately certain: namely, that the average man himself is but a piece of fiction, a tissue of statistics.”
—Vladimir Nabokov (18991977)