[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GT] WWMA is equivalent to EMA, but broken?



Andreas Hartmann wrote:
On Sun, 06 Apr 2008 16:08:56 -0700
"Robert A. Schmied" <ras
AT
acm.org> wrote:


the Wilders.pm code was never committed -- my notes indicate:
 i) the corrected ADX.pm (03/02/08) (also not committed) will need
    change if Wilders.pm name is changed
ii) similarly, other modules using WWMA.pm might benefit from
    change to Wilders.pm


archive messages since first of 2008 that i've found
discussing welles wilders smoothing include:
 wilders.pm code (sub: wilders smoothing dated 03/02/08)
 some commentary on wilders.pm code and wwma code in the ADX thread
  (sub: ADX dated 03/02/08)
 more discussion in wilders versus wwma thread (sub: wilders versus wwma and adx
  dated 03/17/08)

for what it is worth, if the current wwma.pm is implemented incorrectly
then the corrected version should replace it. on the other hand, if there are
significant ambiguities in the interpretation of the welles wilder smoothing algorithm
that result in (significantly) different implementations across the spectrum of
technical analysis codes maybe gt should support more than one. but the module
name should be more descriptive than Wilders.pm.

aloha

ras



Robert,

thanks for pointing me to Wilders.pm. It wasn't in the tarball and I
wasn't searching the mailing list for it. Got it now.

EMA.pm, WWMA.pm and Wilders.pm all use the same formula.

yes. thanks to thomas the new EMA.pm is substantially faster and likely
produces correct results. make sure you've got the version 564 dated
2008-03-12 (or later).

also note the optional 3rd argument for the new EMA.pm which allows one
to alter the starting value. the default is the default SMA.


WWMA is broken, as for every period, it starts iterating anew from
n periods back. It is taking n for a number of periods and for a
smoothing factor (1/n) simultaniously. Both, however have very
different meanings.

yes thomas has pointed this out.


I agree with you regarding the naming. WWMA is probably a good name
to keep for the "Wells Wilders' Moving Average".
So Wilders.pm could become the new WWMA.pm?

There would, however, still be two implementation left for the same
formula, namely EMA and WWMA. The difference being the way the
smoothing factor is treated.
I was thinking of having just one implementation of an
"Exponential Moving Average", e.g. the existing EMA, and have the
new WWMA and possibly others to come, soley be a wrapper around EMA,
passing e.g. n[EMA]=2*n[WWMA]-1 and an initial value method to it?
But this might impact performance, especially for calculate().

Andreas


i'm in favor of replacing the current WWMA module with one that works.

given that creating gt indicators seems to be somewhat of a black art
(despite of thomas weigerts' "writing an [gt] indicator cookbook"),
especially when dealing with initial values and the quantity of prior
time period data, i'd also favor the simpler solution, but i'm hardly
the one to judge.

since there seems to be a question (or issue or ambiguity) regarding
what welles wilder had in mind for the "starting value" it would seem
to me to make that parameter an optional input argument. the default
should be acceptable to most, but alterable for the rest.

i do believe that is the direction thomas weigert was heading since
around the middle of march (see archive sub: "RE: [GT] wilders versus wwma and adx"
dated 03/17/08 16:26) but may have been hit by a tangent and has yet to
return to this thread.

in the mean time additional discussion as to what the "starting value"
should be would seem to be useful.


aloha

ras