Exponentially moving average (EMA) is widely used in signal processing to filter or predict time serial data, such as stock price, see Fig.1. The definition of EMA is shown in Eq.1 where the estimated value at current step is a weighted sum between previously estimated value and currently observed value , and the weight is .

(1)

Eq.2 shows the first three iterations of EMA.

(2)

Theoretically, EMA considers all previously observed values, but their weights decrease exponentially. For example, for the current estimated value, the observed value from steps ago is weighted by . Therefore, we usually define the window width of EMA as which means for , the window width is about and weight from step ago is which is small enough. The blue line in Fig.1 shows the 20-period EMA of the stock price estimation, i.e.,. As we can see from this figure, the blue line is much smoother than the actual data.