EMA Initialization and the Effect of Starting Values
Summary
The document compares two ways to initialize an exponential moving average. One approach begins with a simple moving average over the chosen lookback window; the questioner proposes generating earlier EMA values recursively, using a smoothing factor that changes with the index. A response says this alternative is usable and notes that another common convention starts the EMA at the first observation.
The explanation gives the standard recursive EMA representation and describes how the influence of an initial observation decays over subsequent periods. A table illustrates that decay for several smoothing factors and lag counts. The practical point is that initialization often matters less after enough observations, though the rate of decay depends on the smoothing factor. The document does not establish one initialization as universally correct; choices affect early values, and comparisons should account for conventions and available history.
Key ideas
- An EMA requires an initial value, and common conventions include an initial simple moving average or the first observation.
- The proposed approach changes the smoothing factor with the index during early observations.
- The influence of an initial value decays as later observations enter the recursive average.
- The speed of decay depends on the smoothing factor and the number of subsequent periods.
- Different initialization choices can affect early EMA values, so the convention should be documented.
Tags
Full text
# Initial value of EMA
# Initial value of EMA
https://school.stockcharts.com/doku.php?id=technical_indicators:moving_averages
It says "First, calculate the simple moving average for the initial EMA value. An exponential moving average (EMA) has to start somewhere, so a simple moving average is used as the previous period's EMA in the first calculation."
Why not just do something like this, for 1<= i <len?
EMA[i] = (close[i]-EMA[i-1])*lambda + EMA[i-1], where lambda=2/(i+1).
The advantage is that there are still values for 1<= i <len. But using the definition in the cited page, there will be no definition for those periods.
Has anybody used my definition? If so, is there a reference for this version of EMA definition?
## Answer by Kermittfrog (score 2)
https://quant.stackexchange.com/a/70529
In brevety: Yes, you can use your ansatz, but it simply should not matter too much. Note: The standard (Wikipedia) definition sets $EMA_0=X_0$.
Why is the starting value not really relevant: Given observations $X_t$, $t=0,1,2,\ldots$, the EMA $S_t$ can be written as
$$ \begin{align} S_t&=\lambda X_t+(1-\lambda)S_{t-1}\\ &=\lambda\sum_{i=0}^{\infty}(1-\lambda)^iX_{t-i} \end{align} $$ Where the $\infty$ is used as shorthand for "use all data points from the past". In most practical cases, the choice of the initial value becomes irrelevant after a couple of lags:
```
lambda n weight of first element
0.01 25 0.78 %
0.01 100 0.37 %
0.1 25 0.72 %
0.1 100 0.00 %
0.9 25 0.00 %
0.9 100 0.00 %
0.99 25 0.00 %
0.99 100 0.00 %
```Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.