[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GT] WWMA is equivalent to EMA, but broken?
Hi,
I am convinced that the WWMA Indicator is essentially the same as
the EMA Exponential Moving Average.
One can re-arrange the EMA formula and compare it with the WWMA
formula:
EMA[t] = EMA[t-1] + a * (S[t] - EMA[t-1])
EMA[t] = EMA[t-1] + a * S[t] - a * EMA[t-1]
EMA[t] = a * S[t] + EMA[t-1] - a * EMA[t-1]
EMA[t] = a * S[t] + (1 - a) * EMA[t-1]
EMA[t] = a * S[t] + (1 - a ) * EMA[t-1]
WWMA[t] = (1/n) * S[t] + (1 - 1/n) * WWMA[t-1]
The last two lines show that WWMA is just using a different
smoothing factor.
The EMA smoothing factor is calculated from a = 2/(n+1), with n
being the value actually passed to the indicator. This n is of
course different from the one passed to WWMA. But it follows from:
a = 2/(n[EMA]+1) = (1/n[WWMA])
that:
n[EMA] = 2*n[WWMA]-1
So, for example, {I::EMA 59} and {I:WWMA 30} are equivalent!
They should, apart from small differences caused by varying
selection of the initial values create the same results. But the
plots of the two look comletely differnt. Is WWMA broken?
Would it be desirable to have the WWMA indicator nevertheless, for
the purpose of making available the differnt weighting of the
smoothing factor?
Or just have WWMA convert the smoothing factor and pass it to EMA?
The problem of the initial value came up in a post a while ago, and
it basically affects every indicator which uses Y[t-1] to calculate
Y[t]. To use the first sample itself would probablay a sensible
default, and uniform configurability for all affected indicators
desirable.
Another issue is whether the initial value should be taken from the
beginning of the desired range or from the beginning of all available
data.
I have tried to fix WWMA but I am battleing with messages like:
Use of uninitialized value in numeric gt (>) at ../GT/Graphics/Tools.pm line 175
By the way, there is another WWMA formula at
http://www.fmlabs.com/reference/WellesMA.htm
which also translates to EMA.
Andreas