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

Re: [amibroker] Lesson Learned NZ Function.



PureBytes Links

Trading Reference Links

Hello,
 
If you moved Nz to work directly on result of DIVISION then SetOption would not be needed.
The point is that Nz should enclose divisions that may produce Infinity.
 
chk = Sum( Nz( ( ( C-L )-( H-C ))/ (H-L) )*V, 21) / Sum(V, 21);

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
Sent: Wednesday, January 11, 2006 6:03 PM
Subject: [amibroker] Lesson Learned NZ Function.

 
I'd like to pass along a lesson this nonprogrammer learned. Read the directions. I've been using a Chaiken function to make a surrogate for an uptrend instead of advance decline line. Werner Ganz thought up the idea and it seemed to work nicely. Here's code;
 
chk = Nz(Sum(((( C-L )-( H-C )) / (H-L))*V, 21) / Sum(V, 21));
 
Composites were made to show when this was positive on a list of tickers and plotted as a % of total tickers. Usually it centers around the 50% line + or - 15%. Lately it read 95%+. But it seemed to work on an old version of AB.
 
Turned out it was the NZ function causing the problem.  NZ keeps the formula from blowing up when H = L or just bad data. It returns 0.0 instead of nonsense. But the latest version of AB beta has been changed to speed things up.
From Marcin:
_________________________________________________________________
 
Use:
SetOption("EveryBarNullCheck", True)
 
Indeed - the arrays where you have nulls in the middle are calculated differently in the latest betas.
 
In the readme file you can read:
SetOption("EveryBarNullCheck", True)- allows to turn on checking for Nulls in arithmetic operations on every bar in the array(by default it is OFF - i.e. AmiBroker checks for nulls that appear in the beginning of the array and in the end of the array and once non-null value is detected it assumes no further holes (nulls) in the middle). Turning "EveryBarNullCheck" to True allows to extend these checks to each and every bar which is the way 4.74.x and earlier versions worked.

Note however that turning it on gives huge performance penalty (arithmetic operations are performed even 4x slower when this option is ON, so don't use it unless you really have to).
 
See also Tomasz explanations at:
 
___________________________________________________________
 
Thanks Marcin
 
BTW. If you have dirty data, like mine, anytime an indicator has price in the denominator, the formula can blow up and NZ is needed. This includes relative strength.
 
 
Dave
 


Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS