PureBytes Links
Trading Reference Links
|
At 1:28 PM -0600 7/19/01, Mark Jurik wrote:
>There are two ways to handle this, improve precision (not the Omega way) or write sophisticated algorithms (also not the Omega way).
Actually there is an even simpler way that requires modifying only
one line of the Omega code (see below).
I replaced:
if currentbar = 1
with:
if Mod(currentbar, 100) = 1
to cause the routine to recalculate it accurately every 100 bars but
still use the fast calculation on the other 99 bars. This eliminates
the error buildup with less than a 1% decrease in speed.
This is an example of how a tiny bit of attention to detail by Omega
could have greatly reduced the numerical errors.
Bob Fulks
{ *******************************************************************
Study : AverageAC
Last Edit : 10/7/98
Provided By : Bob Fulks
© 1998 Bob Fulks, All rights reserved.
********************************************************************}
inputs: Price(NumericSeries), Length(NumericSimple) ;
vars : Sum(0), Counter(0) ;
if Mod(currentbar, 100) = 1
then begin
Sum = 0;
for counter = 0 to Length - 1
begin
Sum = Sum + Price[counter];
end;
end
else
Sum = Sum[1] + Price - Price[Length];
if Length > 0 then
AverageAC = Sum / Length
else
AverageAC = 0;
|