PureBytes Links
Trading Reference Links
|
Seems most people do not even know what exponential
moving averages are any more ...
A long story (and unrelated to the one requested) -
The formula that Omega use and other software
vendor use is the inductive formula ...
The original definition of exponential moving
average is simply the average of everthing so far :)
i.e. you can add all the data from the beginning
up to the point where you want your exponential
moving average - you will get the correct answer.
Such correct definition of exponential moving average
is useless in real life (5 years ago) because if
you are calculating a chart with 5000 bars, then
the cost of repeated calculation is
bar 1 1 time
bar 2 2 times
bar N N times
bar 5000 5000 times
Every new bar has to recalc really long period of
time and every new bar demands more time to complete
its calculation.
Then someone thought of a more clever way.
Why not keep adding the new terms to a sum and
just divide it by the count of terms to get the
correct answer?
Ooops, when the sum is pretty small as the prices
do not change that much anyway but the count keep
growing, the problem of modern computers shows -
namely, the round off error due to huge discrepency
between 2 numbers. Making the computed result
useless.
Then, again some clever souls in mathematics figured
out the inductive formulas for exponential moving
average ... they proved that you can inductively
calculate the exp mov avg by knowing the previous
term only. Thus reduced the error greatly.
But the result is still way off for many cases,
especially, some trading software like TradeStation v4
because they run on PC with single-precision
floating point calculation only ...
OK - why Length + 1?
In the time of SystemWriter the length can be 0.
plug the length 0 in and you will have a good time :)
The guy who wrote xaverage figured a base case of 0
is important to make the definition complete,
thats all. Thus the definition used in TS is wrong :)
When Length is huge and if it is not single-precision,
it does not matter.
-Lawrence
--- Jack Griffin <jack_2231@xxxxxxxxx> wrote:
> I was just noticing that there are two different
> XAverage functions in Tradestation. One has a
> smoothing function of 2/(1+Length) while the other
> ("orginal version") has a smoothing function of
> 1/Length. It seems the conventional exponential
> moving average is the former (with the 2).
>
> Does anyone happen to know who decided to put that 2
> in there and why? Just curious and thought I'd ask
> old timers on the list in case they has a nice story
> to tell.
>
> Jack
>
>
=====
Lawrence Chan http://www.tickquest.com
Home of trading tools NeoBreadth and NeoTicker series
|