Skip to content
All library documents

How Exponential Moving Averages Handle Short Histories and Missing Earlier Data

Article Quant Q&A · Author: givanse

Summary

The document explains how an exponential moving average can appear before a chart contains a full nominal lookback period. One answer describes a finite-window exponential weighting scheme: weights are normalized across the available observations, and the window can grow as new data arrive until it reaches the target length. Another answer emphasizes that the standard EMA is recursive and can be computed from the first available observation, without waiting for a complete window. Its smoothing factor is related to the commonly stated period length.

The chart’s early values may therefore come from an incomplete history, where the initialization influences the result. Alternatively, the chart provider may have used price observations from before the displayed range. The discussion uses a Bitcoin chart with no visible data before 2010 and compares EMA calculations on crude oil series with different starting dates to show that initialization history changes values. It does not establish which method the Bitcoin chart actually used, so both explanations remain possibilities.

Key ideas

  • A recursive EMA can produce values before a full nominal period of observations is available.
  • A finite-window exponential average can normalize weights over the shorter history available at the start.
  • The EMA smoothing factor is derived from its stated period length.
  • Early EMA values depend on initialization and may differ when the underlying history starts at a different date.
  • Displayed chart history may omit older observations used to calculate the indicator.

Tags

Full text
# Exponential moving average values before the data range is met?


# Exponential moving average values before the data range is met?












The above chart plots a 300 weekly exponential average. With 52 weeks per year, the indicator would start calculating the EMAVG after 5.77 years, in 2016.

What technique could it be using to be able to calculate EMAVG values for the weeks before 2016?

note: that is a bitcoin price chart, there is no data before 2010

## Answer by Kermittfrog (score 2)

https://quant.stackexchange.com/a/61326

The exponential weighting scheme yields an estimate $Z_t$ from observations $X_t$

$$ Z_t=\sum_{k=0}^{\infty} w_k X_{t-k} $$

where the (infinite) series of weights sums to one, i.e. $\sum_{k=0}^{\infty} w_k=1$.

Let's call the exponential weighting parameter $\lambda$. For a 'lookback window' of length $N$ elements, this results in a weight for the elements $k=0,1,\ldots,N$ of

$$ w_N(k)=\lambda^k\frac{1-\lambda}{1-\lambda^{N+1}} $$

So for the first $M<N$ elements, you would simply calculate the EWMA using a smaller data window, increasing until sufficient length $N$, and then simply roll with the $w_N(k)$ weights.

HTH?

## Answer by Sergei Rodionov (score 1)

https://quant.stackexchange.com/a/61332

The initial price values on the chart are close to the EMA values which suggests that the EMA was calculated over an 'incomplete' window.

The EMA function is unbounded and is calculated recursively over all preceding values. It doesn't require a minimum number of samples to be present. But it needs a smoothing parameter `α` in the range `[0, 1]` to deflate far-away samples. The parameter is non-intuitive and is often substituted with the `N` parameter (number of periods) which relates to `α` as `α = 2/(N+1)`. For instance, `EMA(N=300)` is converted to `EMA(α=0.00664)` behind the scenes.

Another explanation is that the EMA was calculated over raw data prior to 2010 and this raw data is not displayed.

The screenshot below shows weekly crude oil prices from FRED. Raw prices are in blue.

The top chart shows EMA functions with various N parameters applied to time series starting with January 2010. The bottom chart shows the same EMA functions calculated from 2000 onward. Notice how EMA(300) shows different values on January 2010.

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.