MovingAverage
Details

- MovingAverage[list,r] gives a list of the means of elements in list taken in blocks of length r. »
- MovingAverage[list,wts] is equivalent to ListCorrelate[wts/Total[wts],list]. »
- MovingAverage handles both numerical and symbolic data.
- MovingAverage gives a list of length Length[list]-r+1.
- MovingAverage works with SparseArray and TemporalData objects. »
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (5)Survey of the scope of standard use cases
Lists of integers yield rational numbers:

https://wolfram.com/xid/0fq33uh1qn7a8-nib

Lists of approximate numbers yield approximate numbers:

https://wolfram.com/xid/0fq33uh1qn7a8-blyosq

Moving averages of matrices are matrices:

https://wolfram.com/xid/0fq33uh1qn7a8-f6w30t


https://wolfram.com/xid/0fq33uh1qn7a8-hrjjx3


https://wolfram.com/xid/0fq33uh1qn7a8-k2qtt9

Obtain results for lists of any precision:

https://wolfram.com/xid/0fq33uh1qn7a8-dftm52

Obtain results for weights of any precision:

https://wolfram.com/xid/0fq33uh1qn7a8-e6ou1d


https://wolfram.com/xid/0fq33uh1qn7a8-jgjmh7

https://wolfram.com/xid/0fq33uh1qn7a8-cm87ky

https://wolfram.com/xid/0fq33uh1qn7a8-crc6al

Generalizations & Extensions (4)Generalized and extended use cases
Compute results for a SparseArray:

https://wolfram.com/xid/0fq33uh1qn7a8-l4ct3


https://wolfram.com/xid/0fq33uh1qn7a8-d6csj0


https://wolfram.com/xid/0fq33uh1qn7a8-d4vr8

A moving average of TemporalData places the result on the right end of the moving windows:

https://wolfram.com/xid/0fq33uh1qn7a8-kwktnd

Incomplete windows are dropped:

https://wolfram.com/xid/0fq33uh1qn7a8-bjys8


https://wolfram.com/xid/0fq33uh1qn7a8-zv8bvv

The values of a moving average of TemporalData are equivalent to the moving average of its values:

https://wolfram.com/xid/0fq33uh1qn7a8-9somgq


https://wolfram.com/xid/0fq33uh1qn7a8-1jfxow


https://wolfram.com/xid/0fq33uh1qn7a8-1zebv8


https://wolfram.com/xid/0fq33uh1qn7a8-3bcldd


https://wolfram.com/xid/0fq33uh1qn7a8-k1n3kb

The results of a moving average of TemporalData are placed on the right end of the window, and the windows with the smaller number of observations then requested are dropped:

https://wolfram.com/xid/0fq33uh1qn7a8-t5qtkt


https://wolfram.com/xid/0fq33uh1qn7a8-ln31xf

The moving average of a numeric TimeSeries for various window lengths:

https://wolfram.com/xid/0fq33uh1qn7a8-i7bgj9

https://wolfram.com/xid/0fq33uh1qn7a8-q7g8c4

https://wolfram.com/xid/0fq33uh1qn7a8-euuy8l
Incomplete windows are dropped, and the result is placed on the right end of each window:

https://wolfram.com/xid/0fq33uh1qn7a8-z7py9p


https://wolfram.com/xid/0fq33uh1qn7a8-fa5nzt

Applications (2)Sample problems that can be solved with this function

https://wolfram.com/xid/0fq33uh1qn7a8-j42qsa


https://wolfram.com/xid/0fq33uh1qn7a8-biof3w


https://wolfram.com/xid/0fq33uh1qn7a8-wjb0f


https://wolfram.com/xid/0fq33uh1qn7a8-czj2v8

Compute the 100-day moving average of a financial time series:

https://wolfram.com/xid/0fq33uh1qn7a8-ur987c


https://wolfram.com/xid/0fq33uh1qn7a8-cq2lfi

Properties & Relations (7)Properties of the function, and connections to other functions
A moving average is a sequence of means:

https://wolfram.com/xid/0fq33uh1qn7a8-bxc2b1


https://wolfram.com/xid/0fq33uh1qn7a8-i0fg4m

A two‐term MovingAverage is equivalent to a two‐term MovingMedian:

https://wolfram.com/xid/0fq33uh1qn7a8-i96jjd


https://wolfram.com/xid/0fq33uh1qn7a8-1z6z5

MovingAverage is equivalent to MovingMap of Mean:

https://wolfram.com/xid/0fq33uh1qn7a8-bcf2i7

https://wolfram.com/xid/0fq33uh1qn7a8-banxzo


https://wolfram.com/xid/0fq33uh1qn7a8-dm1j4i


https://wolfram.com/xid/0fq33uh1qn7a8-ej6qwp

An n‐term moving average is equivalent to a moving average with n equal weights:

https://wolfram.com/xid/0fq33uh1qn7a8-bht95i

https://wolfram.com/xid/0fq33uh1qn7a8-j2233w


https://wolfram.com/xid/0fq33uh1qn7a8-slsqb

An n‐term moving average is equivalent to a ListCorrelate:

https://wolfram.com/xid/0fq33uh1qn7a8-cv4c5m


https://wolfram.com/xid/0fq33uh1qn7a8-fynz0w

An n‐term weighted moving average is equivalent to a ListCorrelate:

https://wolfram.com/xid/0fq33uh1qn7a8-joj1hm


https://wolfram.com/xid/0fq33uh1qn7a8-hh3b5j

Multiplying weights by a constant gives the same moving average:

https://wolfram.com/xid/0fq33uh1qn7a8-c0225r

https://wolfram.com/xid/0fq33uh1qn7a8-d3zciv

Wolfram Research (2007), MovingAverage, Wolfram Language function, https://reference.wolfram.com/language/ref/MovingAverage.html.
Text
Wolfram Research (2007), MovingAverage, Wolfram Language function, https://reference.wolfram.com/language/ref/MovingAverage.html.
Wolfram Research (2007), MovingAverage, Wolfram Language function, https://reference.wolfram.com/language/ref/MovingAverage.html.
CMS
Wolfram Language. 2007. "MovingAverage." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MovingAverage.html.
Wolfram Language. 2007. "MovingAverage." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MovingAverage.html.
APA
Wolfram Language. (2007). MovingAverage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MovingAverage.html
Wolfram Language. (2007). MovingAverage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MovingAverage.html
BibTeX
@misc{reference.wolfram_2025_movingaverage, author="Wolfram Research", title="{MovingAverage}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/MovingAverage.html}", note=[Accessed: 12-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_movingaverage, organization={Wolfram Research}, title={MovingAverage}, year={2007}, url={https://reference.wolfram.com/language/ref/MovingAverage.html}, note=[Accessed: 12-May-2025
]}