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

RE: Warning about accuracy of Array functions in TS2000i



PureBytes Links

Trading Reference Links

All:  Please remember that the single precision problem is generic, and not
limited to array functions.  To give an example from an old posting, the
OpenPositionProfit function in TS2000 was unable to handle a 100 share
position in QCOM back when it was in the 400s (pre-split).  Any strategy
tested at the time on QCOM which happened to use trades of 100 shares rather
than 1 or 10 would give garbage results -- and TechSupp at Omega owned up to
the fact that this problem was rooted in their single-precision
calculations...  The moral is that the accuracy problem can, indeed, bite
you on the ass in ways that you wouldn't expect and couldn't guess...

-----Original Message-----
From: Bob Fulks [mailto:bfulks@xxxxxxxxxxxx]
Sent: Friday, March 17, 2000 2:41 PM
To: M. Simms
Cc: omega-list@xxxxxxxxxx
Subject: RE: Warning about accuracy of Array functions in TS2000i


At 10:51 AM -0500 3/17/00, M. Simms wrote:
>
>I "HEAR" everyone, but can someone "SHOW ME" how significant the difference
>is ?


Take a look at the series version of the simple moving average function.

The code says:

   Sum = Sum[1] + Price - Price[Length];

Do this for 20000 bars with a price equal to the DJIA at about 10000 and see
what kind of errors you get.

There are a lot of functions such as this that save calculations by dropping
off the old value and adding the new value for the new bar. Errors can
easily accumulate to be very significant, especially if square of price is
involved..

This can be helped a lot by very simple tricks. For example, in the Average
function where they said:

  if CurrentBar = 1 then begin

if they instead said:

  if Mod(CurrentBar, 100) = 1 then begin

they would force the function to re-initialize the value every 100 bars,
which would eliminate most errors with a negligible increase in processing
time.

I have posted lots of examples in the past but cannot find one right now.

Believe me, the 16 bit accuracy is very marginal and it requires effort to
avoid problems. I happened to be working on a problem for the past two days
that I just discovered was caused by numerical calculation errors.

Bob Fulks