PureBytes Links
Trading Reference Links
|
This is very kind to you, but I suspect that your current gripe against
TRAD still continue to produce some negative side effects, because you do
not want to take in account what I explained to you.
So, here are the fix of the few errors in your summary post.
Most of you forget what is the precision carried by the original data
price) and what is the precison expected from any calculationthat derives
from the original prices.
It'sad, but it's true...
> -----Message d'origine-----
> De : Bob Fulks [mailto:bfulks@xxxxxxxxxxxx]
> Envoye : jeudi 26 juillet 2001 21:16
> A : omega-list@xxxxxxxxxx
> Objet : TradeStation Precision - Summary
>
> SUBTRACTING TWO NEAR-EQUAL NUMBERS
>
> There are a lot of functions that subtract two prices to find a small
> difference between the two. For example, The Dow Jones Industrial
> Average (DJIA) is at about 10300 so
>
> 10323.45 - 10321.20 = 2.25
>
> is accurate to about 3 digits which is probably OK.
======1========
IT IS OK, and by far!
The DJ is known with a (roughly) relative max precision of 0.01 /10 000 =
10^-6 .
Absolute error carried by DJ is 0.01
When you perform DJ-DJ[1], the absolute error E is the SUM of the errors of
boths terms.
So E(DJ-DJ[1])= E(DJ)+E(DJ[1])= 2.10^-2.
The relative error will be:
E(DJ-DJ[1])(DJ-DJ[1])= 2.10^-2 /2.5 # roughtly 10^-2
far above of the 10^-7 TS relative precision!!!!!
===========2============
If now you perform the difference of the squared values S, the error "E"
must be evaluated from:
S= X2-Y2
E(S) = E(X2)+E(Y2)
Where E(X2) must be evaluated by using the relative error:
E(X2)/X2 = E(X)/X +E(X)/X=
E(X2) = 2*E(X)/X * X2
E(X2) = 2*X*E(X)
Same brings E(Y2)= 2*Y*E(Y)
E(S) = E(X2)+E(Y2) = 4*X*E(X) roughly because X and Y are very close ( they
are DJ and DJ[1]).
So, the final precision for a correct calculus of a difference of two close
squared numbers is, for the DJ:
E(S) =4* 10^4* 10^-2 = 4* 10 ^2
(This of course apply to a squared sum too).
Knowing that X and Y are very close, |S|= X2-Y2 = 2*|X-Y|= 5 ( roughly)
The relative error of the difference is:
E(S)/S= 4*X*E(X)/2*|X-Y|
______________________
E(S)/S= 2*X*E(X)/|X-Y| (I)
----------------------
=2*10^4*10^-2/5 = 4*10^1 = 40 (4,000% in this case)
Now the relative error carried by a TS Float being between around 10^-7
0.00001%), the squared sum or difference is perfectly exact, because the
relative error E is not destroyed by the relative error from the TS Float
intrinsic error, far, far below...
===========3==========
For a sum S = X2+Y2, the relative error will be :
E(S)/S= 4*X*E(X)/2*X2 =
_________________
E(S)/S = 2*E(X)/X (II)
-----------------
= 2* 10^-2 /10^4 = 2* 10-6 =0.00002%
Compare the results from I and II and you will see that the relative error
has nothing to do with a sum of squared and a difference of sqared values,
and that in any case, the TS precision do not damage the precision of the
calculus.
Your main error is that you do not understand that if a price like DJ is
1000.25, it means that you can write it 1000.25***** where **** is garbage
translate , by unknown, impossible to determine..)
It's a nonsense to consider that a price has more precision than the number
of digit used to display it.
The sequel is that any calculation that derives from prices must not use the
garbage values of the original data, and must no use more precision ( 1
digit more is admitted) for intermediate calculus, because all of the
precision that you expect beyond is garbage, and this is a consequence of
the error evaluation that any physics student should know and not forget.
Asking for doubles to add more garbage precision in the garbage part of the
calculus is also a bigger nonsense.
The TS choice was reasonable to use the type of float they use, because they
know that the precision of the original material ( price) is far below their
internal precision, period.
No need to perform tests, this is the theory
> But many
> functions subtract the square of price or Price1*Price2 and these
> can give very inaccurate results.
They certainly have not the same precision than garbage values produced with
10 digits after the expected level of precision.
> SUMMARY
>
> The use single-precision floating point was probably a good design
> decision when memory was expensive and TradeStation 4.0 was limited
> to the 64K program size. Unfortunately, Omega did not write their
> function library so that it produced accurate results with the
> available arithmetic so the users must be alert for and "work-around"
> such errors.
>
> Now days, memory is very much less expensive so most modern programs
> use double-precision floating point arithmetic. Unfortunately Omega
> retained the single-precision arithmetic in TS2000i so we still have
> to worry about these issues.
========4==========
I do not believe that it is related to 64K program size!
This deals more probably with speed: Performing calculus with doubles ( 64
bit) is certainly not as fast as with floats (32 bits), knowing that the
computer does binary operation after all.
So think twice if the speed to add two doubles is the same than to add two
floats, and that it is not necessary to use this for 4 or 5 digits data
prices).
=======5=====For non maths oriented readers======
If you do not understand the true meaning of physical precision
experimental precision) and its consequences, please do this small
experience:
1- Measure the lenght of your table very carefully with a ruler
Write down the result in millimeters ( I supose that you will not achieve
the 1/10 mm precision).
For example, you have found L = 1531 mmm = 1.531 10^3 m
2- I have attached to this post a magic tool that you will use now: It is a
small device that will add a single atom at the end of the table length.
The size of this atom is ll= 2 nanometer (2 *10^ -9 m)
Now, do you think that you are authorized to say that the length of the
modified table is the sum L+ll?
Do you really think that the length of your table is now really 1.531000002
m ?
If you are still saying "yes", please continue to ask for double precision
in technical analysis software, because you like garbage, and you need more
than what you currently have.
Sincerely,
Pierre Orphelin
www.sirtrade.com
TradeStation Technologies representative in France
|