AIQ is a part of Track Data Corporation (NASD symbol TRAC) www.trackdata.com


Example 2

This section is designed to give examples of an actual routine and an explanation of how of each part of the routine works.





 
 

 


 

The second example will analyze the IFF function line by line.

 

1)! This file is just a demonstration of the IFF function.
2)! All stocks run through this test will pass.  
3)! The ChangedUpUDF is used to show whether the
4)! stock closed up or down.

5)PreviousDaysClose is val([close],1).
6)TodaysClose is [close].

7)Change is TodaysClose - PreviousDaysClose.

8)! The IFF reads like: If Change is > 0 then 1 else 0.
9)! The then/else parts may be expressions, Rules or UDFs.
10)ChangedUp is iff(Change > 0,1,0).

11)! this rule is ALWAYS TRUE.
12)rule if 1.

 


Lines 1 - 4, 8,9 & 11 are comments. They are identified by exclamation marks at the beginning of each line. 

EDS will not process lines that start with an exclamation mark.

 

Line 5 is a UDF. This line links the value of yesterdays close with the udf name PreviousDaysClose.

 

Line 6 is a UDF. This line links the value of today's close with the udf name TodaysClose.

Line 7 is a UDF. This line links the value of the difference of TodaysClose and PreviousDaysClose with the udf name Change.

Line 10 is also a UDF. This line uses the IFF function to return a value if an evaluated rule is true and a different value if the evaluated rule is false.  If "Change", which is the difference of TodaysClose and PreviousDaysClose,  is greater than 0 the returned number is 1. If "Change" is less than 0 the returned value is 0. The function links the returned value with the udf name ChangedUp.

 

Line 12 is a rule. The rule rule is an always true rule that will return all tickers. If you add ChangedUp as a UDF column to your report the column will return a value of 0 or 1. If the stock had a change up, meaning the difference of today's close and yesterdays close is greater than 0, then the value returned will be 1. If there is no change or negative change the value returned will be 0.