ExponentialMovingAverage[list,α]
gives the exponential moving average of list with smoothing constant α.
ExponentialMovingAverage
ExponentialMovingAverage[list,α]
gives the exponential moving average of list with smoothing constant α.
Details
- The smoothing constant α is typically a number between 0 and 1, but can be any expression.
- ExponentialMovingAverage[x,α] generates a list of results
in which
. » - The output from ExponentialMovingAverage[list,α] has the same length as list.
- ExponentialMovingAverage handles both numerical and symbolic data.
- ExponentialMovingAverage works with SparseArray and TemporalData objects. »
Examples
open all close allBasic Examples (2)
Scope (4)
Compute exponential moving averages at machine precision:
ExponentialMovingAverage[N[{1, 5, 7, 3, 6, 2}], 1 / 2]Exponential moving averages of matrices are matrices:
data = RandomReal[5, {10, 2}]ExponentialMovingAverage[data, 1 / 4]Obtain results for lists of any precision:
ExponentialMovingAverage[N[{1, 5, 7, 3, 6, 2}, 25], 1 / 2]Obtain results for smoothing coefficients of any precision:
ExponentialMovingAverage[{1, 5, 7, 3, 6, 2}, N[1 / 2, 30]]Generalizations & Extensions (2)
Compute results for a SparseArray:
sp = SparseArray[{{i_, i_} :> i, {i_, j_} /; j == i + 1 :> i - 1}, {100, 10}]ExponentialMovingAverage[sp, 1 / 10]Compute results for a TemporalData object:
td = TemporalData[{1, 2, 3}, {0}]ExponentialMovingAverage[td, 1 / 2]Normal[%]Applications (3)
data = Range[20] + RandomReal[{-2, 2}, 20]smoothed = ExponentialMovingAverage[data, 1 / 4]ListPlot[{data, smoothed}, PlotLegends -> {"data", "smoothed"}]Compute an exponential moving average using an initial starting value:
data = Range[20] + RandomReal[{-2, 2}, 20]start = 4.5;smoothed = Rest[ExponentialMovingAverage[Join[{start}, data], 1 / 5]]ListPlot[{data, smoothed}, PlotLegends -> {"data", "smoothed"}]Compute the exponential moving average of a financial time series:
ListLinePlot[ExponentialMovingAverage[FinancialData["GE", "Jan. 1, 2000", "Value"], 0.1]]Properties & Relations (3)
Terms of an exponential moving average satisfy a recurrence relation:
data = RandomReal[10, 100];alpha = 3 / 4;ema = ExponentialMovingAverage[data, alpha];Rest[ema] == Most[ema] + alpha(Rest[data] - Most[ema])Exponential moving average with a smoothing coefficient of 0 is a constant:
ExponentialMovingAverage[{a, b, c, d}, 0]Exponential moving average with a smoothing coefficient of 1 is the original list:
ExponentialMovingAverage[{a, b, c, d}, 1]See Also
Related Guides
History
Text
Wolfram Research (2007), ExponentialMovingAverage, Wolfram Language function, https://reference.wolfram.com/language/ref/ExponentialMovingAverage.html.
CMS
Wolfram Language. 2007. "ExponentialMovingAverage." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ExponentialMovingAverage.html.
APA
Wolfram Language. (2007). ExponentialMovingAverage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ExponentialMovingAverage.html
BibTeX
@misc{reference.wolfram_2026_exponentialmovingaverage, author="Wolfram Research", title="{ExponentialMovingAverage}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/ExponentialMovingAverage.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_exponentialmovingaverage, organization={Wolfram Research}, title={ExponentialMovingAverage}, year={2007}, url={https://reference.wolfram.com/language/ref/ExponentialMovingAverage.html}, note=[Accessed: 12-June-2026]}