Why   α = 1 - 2/(N+1) ... in the EMA formula ?
motivated by e-mail from Ron K

Here, I derived the magic formula for Weighted Moving Average (WMA, with weights 1, 2, 3, ... ), namely:
[0]       WMA(Next) = WMA(Now) + 2/(N+1){PN+1 - SMA(Now)}
where SMA is the simple, garden variety Moving Average and PN+1 is the current price.

Then I wrote down the magic formula for the Exponential Moving Average (EMA, with weights 1, α, α2, ... ), namely
[1]       EMA(Next) = α EMA(Now) + (1-α)PN+1
obtained by replacing MA by EMA, in [0].

>What's that α ?
Aah, that's the big question  
Indeed, any positive number less than "1" would do, yet, for an N-day EMA, everybuddy uses
[2]       α = 1 - 2/(N+1)

>Hence, the big question: Why   α = 1 - 2/(N+1) ?
Exactly, so here's what we'll do:

  • For any positive α < 1, we'll define the N-day EMA as:
    (a)     EMA = (αN-1P1 + αN-2P2 + ... + PN) / K

    That's the weighted average of N prices, with weights 1, α, α2, ... αN-1, PN being the most recent price
    Note that the price N days (weeks? months?) ago is given a smaller weight of αN-1, if α < 1
    It's the powers of α that makes it an exponential average.
  • We choose K so that, if all prices are equal to P, then the EMA equals P as well. That means:
    (b)     P = (αN-1P + αN-2P + ... + P) / K
    hence
    (c)     K = 1 + α + α2 + ... + αN-1 = (1 - αN) / (1 - α)
    ... using the formula for the sum of a geometric series
  • If the P's are (say) daily prices, then the next day we'd calculate:
    (d)     EMA' = (αN-1P2 + αN-2P3 + ... + PN+1) / K

    ... where now PN+1 is the most recent price
  • Now, from from (a) and (d), we calculate:
    (e)     EMA' - α EMA = (PN+1 - αNP1) / K
  • We now have:
    (e)     EMA' = α EMA + (PN+1 - αNP1) / K
  • Finally, we substitute that K-value we got above, in (c):
    (f)     EMA' = α EMA + (1 - α) (PN+1 - αNP1) / (1 - αN)
Okay, some observations:

Observation #1:
If all prices were equal to P (hence EMA = EMA' = P), then (f) would read P = P ... which is comforting.

Observation #2:
If α is small enough and N is large enough, we might ignore αN.
That's like going back to the big bang, rather than just N days.  
Ignoring αN, that'd give the "standard" formula [1], namely:
[3]       EMA' = α EMA + (1 - α) PN+1
Remember: EMA is today's calculated value, EMA is yesterday's ... and PN+1 is today's price.
Note, too, that if all prices were equal to P, then [3] would read P = P.

>And that answers the question: Why α = 1 - 2/(N+1)?
Uh ... no. Not yet.
However, let's first see we can ignore that αN ... so we can use the simple [3] rather than the complex (f).
Let's try some invented sequence of prices and N = 26 and α = 1 - 2/(N+1) = 0.93


Figure 1

>Yeah, so I see stock prices in green, but where's the two EMAs?
I coloured them red and blue, but they're so close together that ...

>The colour is purple, right?
Yes, so with this single example we'll agree to adopt the simpler formula:
EMA(today) = α EMA(yesterday) + (1 - α) Price(today)
where 0 < α < 1

>WE'll agree?
Well ... I will agree.

>So have you answered the question: Why   α = 1 - 2/(N+1) ?
Uh ... not yet.
However, let's look closely at our magic formula:
      EMA(N+1) = α EMA(N) + (1 - α) PN+1
where EMA(N+1) is today's EMA, PN+1 is today's Price and EMA(N) is yesterday's EMA.

We can choose any value of α which lies in between 0 and 1.
Indeed, if we wish to make α depend upon N, we can choose for α any function of N which goes from 0 to 1 as N increases to infinity, say α = f(N) as in Figure 2.

>But that's just the old α = 1 - 2/(N+1) !

Yes, but that's one possibility, but Figure 2 has a few more.
If you prefer another f(N), that'd give a magic formula such as:
      EMA(N+1) = f(N) EMA(N) + (1 - f(N)) PN+1


Figure 2
So, what's your favourite function f(N)?

>Uh ... I sort of like f(N) = tanh(N-1)
Yeah, I got tanh( (N-1)/10 ) in Figure 2, as well as f(N) = 1 - EXP( (N-1)/10) ) as well as ...

>Yeah, yeah, but what's the BEST?
Define "BEST".
Note that α = 1 - 2/(N+1) is certainly the BEST = the simplest.

>I would have thought that α = 1 - 1/N is simplest.
Uh ... yes, I guess it is.

to continue