The

exponential moving average of a

time-series of data is calculated:

ema_{i} = a * x_{i} + (1 - a) * ema_{i-1}

Where ema_{i-1} is the value of the exponential moving average at period i-1,
and x_{i} is the value of the input time-series
at period i.

The weight `a` is typically 2/(n+1) where n is the approximate number of periods one would use in a
simple moving average.

So, if you wanted an exponential moving average which
approximated a 10-day simple moving average, `a` would be equal to 2/(10+1) or about 0.1818.

Therefore,

ema_{i} = 0.1818 * x_{i} + (1 - 0.1818) * ema_{i-1}