PureBytes Links
Trading Reference Links
|
I did not want to jump into this thread as I am
now "yet another software vendor" :)
anyhow, there is a way to make TS4 and Ts2k to
perform calculations more correctly.
use the simple moving average example:
1. maintain a current sum of data, but split that
to 2 parts, the high digits and the low digits.
in the TS4 case, you can limit the significant
digits to 3 for each part.
2. add new term then subtract the oldest term away
for each part.
3. take the average on each part.
4. recombine them.
This way you can reduce the error quite a bit.
Since I stopped using TS already maybe someone can
take the idea to implement that and post to the list.
-Lawrence
--- Mark Jurik <mark@xxxxxxxxxxxx> wrote:
> >>On an even simpler scale, calculate a simple 1000
> bar moving average in TS and compare to Excel or
> C++. TS can't even do this with precision to ONE
> decimal place.<<
>
> There are 2 way to calculate a simple moving
> average. The first is to sum all N numbers and take
> take average, and repeat this on each bar.
> According to numerical analysis, this approach has
> the potential problem that the floating point
> summing variable might become so large that the
> exponent component of the next value being added
> will be off the scale (too small) for the summing
> variable to see. At that point, you can attempt to
> add thousands of more values and nothing happens.
> However, this problem will not occur when N<1000,
> even with single precision. Another drawback of this
> method is that it is very slow for large N.
>
> The other, and faster way, is to keep the current
> sum and simply subtract out the value that fell
> outside the moving window and add the new value that
> just fell in. However, this method is susceptible
> to increasing roundoff error. After about 1000
> cycles, this error becomes significant and mucks up
> accuracy.
>
> There are two ways to handle this, improve precision
> (not the Omega way) or write sophisticated
> algorithms (also not the Omega way).
>
> - mark jurik
>
>
>
> ----------
> From: Neal Falkenberry, CFA
> Sent: Wednesday, July 18, 2001 4:38 PM
> To: Bengtsson, Mats; omega-list@xxxxxxxxxx
> Cc: pierre.orphelin@xxxxxxxxxxxxxx
> Subject: Precision Errors
>
> <<File: ATT00008.txt>>
>
>
=====
Lawrence Chan http://www.tickquest.com
Home of trading tools NeoBreadth and NeoTicker series
|