With weight vector I mean the vector with weights that you have to multiply the observations in the window that slides over your data with so if you add those products together it returns the value of the EMA on the right side of the window.
For a linear weighted moving average the formula for finding the weight vector is:
(1:n)/sum(1:n) (in R code). This series of length
n adds up to 1. For
n=10 it will be
the numbers 1 to 10 / 55, with 55 the sum of the numbers 1 to 10.
How do you calculate the weight vector for an exponential moving average (EMA) of length n?
nis the length of the window, then
Is this correct?
Even though the EMA is not really confined to a window with a start and an end, shouldn't the weights add up to 1 just like with the LWMA?