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


Functions

Learning the Built-in Functions in EDS in the most important part building your own custom scans.

 

 

Please scroll down to view the functions.





 
 

 


 

Built-in Functions

 

The functions listed are available for defining expressions.

Abs

Description: The Abs function returns the absolute value of a number.

Syntax: Abs(number)

Example: num is Abs(-8).

Explanation: The num function contains the absolute value of the number -8, which is 8.

Ceiling

Description: The Ceiling function returns a number rounded to the next highest whole number.

Syntax: Ceiling(number)

Example: num is ceiling(9.6).

Explanation: The function ceiling is applied against the value 9.6, returning the next highest whole number; which is 10.

CountOf

Description: The CountOf function counts the number of times a rule returns true over a given period of time.

DateOffset is an optional parameter that when used starts dateoff-set periods prior to the report date on the EDS toolbar.

Syntax CountOf( rulename, periods, dateoffset )

Example1:   

Step 1 — define rule: Erup if [er up] >= 95.

Explanation: Base rule returns TRUE if the Up ER was >= 95.

Step 2 — Insert function: MultipleERs if CountOf(erup,21) > 5.

Explanation: Count the number of ER’s in the last 21 days. If more than 5, the rule returns TRUE.

Example 2: MultipleERs2 if CountOf(erup,21,5). 

Explanation: Same as rule above but count starts 5 days ago.

Day

Description: The Day function returns the day of the month.

Syntax: Day()

Example: today is day().

Explanation: The Day function contains the current day of the month.

DayOfWeek

Description: The DayOfWeek function returns the numeric value of the current day of the week.

Syntax: DayOfWeek()

Example: Thisdate is dayofweek().

Explanation: The Thisdate function contains the current day of the week. The EDS compiler assigns 0 to Monday, 1 to Tuesday, etc.

Description

Description: The Description function returns the value contained in a ticker’s description field. Typically this is the name of the security.

Syntax: Description()

Example: TickersDescription is Description().

Explanation: The TickersDescription function contains the content’s of the ticker’s description field.

Exp

Description: The Exp function returns the exponential value of a number.

Syntax: Exp(number)

Example: Exponential is Exp(2.3026).

Explanation: The exponential function contains the exponential value of the number 2.3026, which is 10.

ExpAvg

Description: The ExpAvg function computes the exponentially smoothed moving average of a user defined function.

Syntax: ExpAvg(udf, periods, dateoffset).

Example: myudf is val([close],1).

The myudf function contains the value of the [close] indicator from the prior period.

thisisit is ExpAvg(myudf, 5, 1).

Explanation: The thisisit function applies the ExpAvg built-in function against the myudf function over five periods starting with the prior period.

FirstDataDate

Description: Returns the date of the first data for the current ticker. 

Syntax: FirstDataDate()

Example: Firstdate is FirstDataDate().

Explanation: The Firstdate function will return the first date that the ticker has data.

Floor

Description: The Floor function returns a number rounded to the next lowest whole number.

Syntax: Floor(number)

Example: nextlow is Floor(5.25).

Explanation: The nextlow function contains the value computed by applying the floor built-in function against the number 5.25, which is 5.

FundRank

Description: The FundRank function contains the fundamental ranking for that ticker.

Syntax: FundRank()

Example: Rank is fundrank().

Explanation: The Rank function contains the value derived by applying the fundrank built-in function against the ticker.

Future

Description: Returns TRUE if the current ticker symbol being tested is a Future. Use this function to filter tickers based on a type.

Syntax: Future()

Example: FuturesRule if Future() and [close] > 5. 

Explanation: Close greater than 5 ONLY, for futures.

Group

Description: Returns TRUE if the current ticker being tested is a Group. Use this function to filter tickers based on a type.

Syntax: Group()

Example: GroupRule if Group() and [er up] > 90. 

Explanation: Er > 90 only for Groups.

HasDataFor

Description: Checks if the current ticker has data for the specified number of periods. If sufficient periods with data is found, the function returns the number specified. If the number of periods with data is less than the specified number, it returns the number available.

Syntax: HasDataFor(periods)

Example: Hasdata is HasDataFor(200)

Explanation: Returns 200 or if the ticker has data for less than 200 periods it will return the number of periods that it has data.

HighResult

Description: This function returns the highest value of an User Defined Function (UDF) over a given period of time. DateOffset is an optional parameter that if given, will start dateoffset periods prior to the date of the report. Periods may be weekly or daily depending on the Properties setting.

Syntax: HighResult( udf, periods, [dateoffset] )

Example: Step 1 — Define UDF: 

AvgPrice is ( [high] + [low] + [close]) / 3.

Step 2 — Insert funtion: 

HighAvgPrice is HighResult( AvgPrice, 21 ). 

Explanation: Returns the Highest Average Price over 21 days.

HiVal

Description: This function returns the highest value of an indicator field over a given period of time. DateOffset is an optional parameter that if given, will start dateoffset periods prior to the date of the report. Periods may be weekly or daily depending on the Properties setting.

Syntax: HiVal( field, periods, [dateoffset])

Example: HighestER if HiVal([er up],21). 

Explanation: Returns the highest ER in the last 21 days.

IFF

Description: This function will return result of udf1 if the rule is TRUE else it will return result of udf2 if the rule is FALSE.

Syntax: IFF( <rule>, <udf1>, <udf2> ) 

Example: val is IFF( myrule, myfunc1, myfunc2). 

Explanation: If myrule is TRUE, val equals result of myfunc1. If myrule is FALSE, val equals result of myfunc2.

Index

Description: Returns TRUE if the current ticker being tested is an Index. Use this function to filter tickers based on a type.

Syntax: Index()

Example: IndexRule if Index() and [close] > 800. 

Explanation: Price greater than 800 only for Indices.

Ln

Description: This function returns the natural logarithm of number.

Syntax: Ln( number )

Example: num is Ln(10). 

Explanation: Return the natural log of 10.

Log10

Description: This function returns the base 10 logarithm of number.

Syntax: Log10( number )

Example: num is Log10(10). 

Explanation: Return the Log10 of 10.

LoVal

Description: This function returns the lowest value of an indicator field over a given period of time. DateOffset is an optional parameter that if given, will start dateoffset periods prior to the date of the report. Periods may be weekly or daily depending on the Properties setting.

Syntax: LoVal( field, periods, [dateoffset] )

Example: LowestLow if LoVal([low],21). 

Explanation: Returns the lowest low for the last 21 days.

LowResult

Description: This function returns the lowest value of an User Defined Function (UDF), over a given period of time. DateOffset is an optional parameter that if given, will start dateoffset periods prior to the date of the report. Periods may be weekly or daily depending on the Properties setting.

Syntax: LowResult( udf, periods, [dateoffset] )

Example: Step 1 — define UDF: 

AvgPrice is ( [high] + [low] + [close]) / 3.

Step 2 — insert: 

LowAvgPrice is LowResult( AvgPrice, 21 ). 

Explanation: Returns the Lowest Average Price over 21 days.

MarketCode

Description: Returns the code <marketcode> for the market on which the ticker trades.

Syntax: MarketCode()

Example: Buy if MarketCode() = "OC".

Explanation: Returns only those tickers on the Nasdaq Exchange.

Market

Description: Returns TRUE if the current ticker being tested is a Market. Use this function to filter tickers based on a type.

Syntax: Market()

Example: Step 1 — define UDF: 

PositivePhase if [phase] > 0.

Step 2 — insert: 

MarketER if Market() and [er up] >= 95 and PositivePhase.

Explanation: Screens only Market Ticker Types for ERs greater than 95 with phase greater than zero.

Max

Description: This function returns the highest value of either number1 or number2.

Syntax: Max( number1, number2 )

Example: val is Max( 10, 20). 

Explanation: Returns 20 which is the highest number.

Month

Description: This function returns a number representing the current month.

Syntax: Month()

Example:

Explanation:

Min

Description: This function returns the lowest value of either number1 or number2.

Syntax: Min( number1, number2 )

Example: val is Min( 10, 20). 

Explanation: Returns 10 which is the lowest number.

MutualFund

Syntax: MutualFund()

Description: Returns TRUE if the current ticker being tested is a MutualFund. Use this function to filter tickers based on a type.

Example: MFundRule if MutualFund() and [close] > 5. 

Explanation: Rule only applies to MutualFunds.

MutualFundGroup

Description: Returns TRUE if the current ticker being tested is a MutualFundGroup. Use this function to filter tickers based on a type.

Syntax: MutualFundGroup()

Example: MFundGrpRule if MutualFundGroup() and [close] > 5. 

Explanation: Rule only applies to MutualFundGroups.

NoDate

Description: This function returns the constant used internally by Expert Design Studio to signify an invalid date type. This number is -32768. Use this function instead of this number for future compatibility.

Syntax: NoDate()

Example: rule if ScanAny(erup,21) <> NoDate(). 

Explanation: True if an ER up was found in the last 21 days.

OffsetToDate

Description: Returns the number of days from the date specified to the current date. 

Syntax: OffsetToDate(<month>,<day>,<year>) 

Example: NumDays is OffsetToDate(12,05,2001).

Explanation: Will return the number of trading days since 12/05/2001 for a ticker. If the tickers inception date is after the OffsetDate the function will return 0.

PortfolioGroup

Description: Returns TRUE if the current ticker being tested is a PortfolioGroup. Use this function to filter tickers based on a type.

Syntax: PortfolioGroup()

Example: PortRule if PortfolioGroup() and [close] > 5. 

Explanation: Rule only applies to PortfolioGroups.

Power

Description: This function returns x raised to the y power.

Syntax: Power( x, y )

Example: val is Power( 2, 10). 

Explanation: 2 to the 10th power

ReportDate

Description: This function returns the date that the report is being run on.

Syntax: ReportDate()

Example: Date is ReportDate(). 

Explanation: User Defined Function that returns the report date. Date can now be used as a column in the report.

ResetDate

Description: This function is used to reset the date back to ReportDate. This function is useful to remove any date side effects from the ScanAny function described later. This function always returns TRUE.

Syntax: ResetDate()

Example: Step 1 — define UDF: 

erup if [er up] > 90.

Step 2 — insert: 

Rule if ScanAny(erup,21) and ResetDate(). 

Explanation: Test for occurance of ER’s then reset the date back to the report date.

Round

Description: This function rounds a number to the nearest whole number.

Syntax: Round( number )

Example 1: val is Round(9.6). 

Explanation: returns 10

Example 2: val is Round(9.4)

Explanation2: returns 9

RSIndex

Description: This function returns the Relative Strength index <"ticker"> for the currently active ticker.

Syntax: RSIndex()

Example: Index is RSIndex().

Explanation: Will return the Index ticker for the stock if the relative strength is set correctly.

RSTicker

Description: This function returns the Relative Strength ticker <"ticker"> for the currently active ticker. If you set your RS tickers in Data Manager to your group structure pyramid you can do group analysis in EDS.

Syntax: RSTicker()

Example: Group is RSTicker().

Explanation: Will return the group ticker for the stock if the relative strength is set correctly.

RuleDate

Description: This function returns the date that ScanAny found a rule to be TRUE on.

Syntax: RuleDate()

Example: Step 1 — define rule: 

rule if ScanAny(erup,21).

Step 2 — insert:

DaysAgo is ReportDate() - RuleDate(). 

Explanation: Finds out how many days ago the scanany function found the rule erup to be true.

ScanAny

Description: This function is used to perform a rule over a given period of time. If a rule is found to be TRUE during this period, the function returns the date that the rule was TRUE on. If a rule is not found to be true, this function returns -32768. Use the function NoDate() to determine if a valid date was found. The dateoffset parameter is optional and if specified, the scan will start dateoffset periods ago. This function will modifiy the internal Date inside of Expert Design Studio. All subsequent values retrieved after this rule will be from the date the ScanAny found the rule to be TRUE on. If this is not the desired behavior, follow the ScanAny function with a ResetDate().

Syntax: ScanAny( rule, periods, [dateoffset] )

Example: Step 1 — define rule: 

erup if [er up] > 90.

Step 2 — insert: 

AnyErs if ScanAny(erup,21) <> NoDate() and ResetDate().

Explanation: See if any ER’s occured over the last 21 days. Do not keep the date around. Reset it 

Sector

Description: Returns TRUE if the current ticker being tested is a Sector. Use this function to filter tickers based on a type.

Syntax: Sector()

Example: SectorRule if Sector() and [er up] > 90. 

Explanation: Er > 90 only for Sectors

SetDate

Description: This function is used to set the internal date back the number of periods specified. All Subsequent rules and values obtained will be from this new date. This function always returns TRUE.

Syntax: SetDate( periods )

Example: funkyer if SetDate(5) and [er up] > 90. 

Explanation: ER 5 days ago.

SimpleAvg

Description: Computes the simple moving average of a user defined function (UDF).

Syntax: SimpleAvg(udf, periods, [dateoffset])

Example: avg is SimpleAvg(somefunc,20). 

Explanation: Computes the 20 simple average of a function.

Slope

Description: This function will compute the slope of a given indicator field for the number of periods given. DateOffset is an optional parameter and if given, the slope will be computed starting dateoffset days ago.

Syntax: Slope( field, periods, [dateoffset] )

Example: TrendChange if slope([close],10,5) > 0 and slope([close],5) < 0.

Explanation: Trend Changed if the 10 day slope 5 days ago is positive and the most recent 5 day slope is negative.

Slope2

Description: This function will compute the slope of the parameter defined by a User Defined Function for the number of periods given. DateOffset is an optional parameter and, if given, the slope will be computed starting dateoffset days ago.

Syntax: Slope2( <udf>, periods, [dateoffset] )

Example: TrendChange if slope([<udf>],10,5) > 0 and slope([<udf>],5) < 0.

Explanation: Trend Change if the 10 day slope 5 days ago is positive and the most recent 5 day slope is negative.

Sqrt

Description: This function returns the square root of number.

Syntax: Sqrt( number )

Example: val is sqrt(5*5). 

Explanation: returns 5

Stock

Description: Returns TRUE if the current ticker being tested is a Stock. Use this function to filter tickers based on a type.

Syntax: Stock()

Example: StockRule if Stock() and [er up] > 90. 

Explanation: Er > 90 only for Stocks

Sum

Description: This function will sum the result of a given User Defined Function over the given period of time. DateOffset is an optional parameter and if given, the summation will start dateoffset days ago.

Syntax: Sum( udf, periods, [dateoffset] )

Example: Step 1 — define UDF: 

AvgPrice is ( [high] + [low] + [close]) / 3.

Step 2 — insert: 

val is Sum(AvgPrice,21)/21. 

Explanation: Compute the 21 day average price.

Symbol

Description: This function returns the ticker symbol <"string"> for the currently active ticker.

Syntax: Symbol()

Example: Symbol is Symbol().

Explanation: This function will return the symbol for the ticker.

TickerRule

Description: Evaluates a specified rule for a specified ticker and returns the boolean result (TRUE or FALSE). 
Required parameters are:

<"ticker"> string specifying a ticker name
<rule> rule name

Syntax: TickerRule(<"ticker">,<rule>) 

Example: Example: Step 1 — define rule: 

rule if [ER] > 90.

Step 2 — insert rule:

Er90DOW if TickerRule("DJIA",rule). 

Explanation: Er90DOW will return all tickers when the Dow has an ER of greater than 90.

TickerUDF

Description: Evaluates a specific UDF for a specified ticker and returns the value of the UDF <number or string or date>. The result of the UDF is the same as the UDF return.

Required parameters are:

<"ticker"> string specifying a ticker name
<UDF> UDF name

Syntax: TickerUDF(<"ticker">,<udf>) 

Example: Step 1 — define UDF: 

AvgPrice is ( [high] + [low] + [close] ) / 3.

Step 2 — insert UDF:

MSFTAvg is TickerUDF("MSFT",AvgPrice).

Explanation: MSFTAvg will return the average price for Microsoft.

Val

Description: This function returns the value of an Indicator Field for periods ago. DateOffset is an optional parameter.

Syntax: Val( field, periods, dateoffset )

Example: YesterdaysClose is Val([close],1). 

Explanation: Retrieve closing price 1 day ago.

ValResult

Description: This function will return the result of an User Defined Function n periods ago. DateOffset is an optional parameter.

Syntax: ValResult( udf, periods, dateoffset )

Example: Step 1 — define UDF: 

AvgPrice is ( [high] + [low] + [close] ) / 3.

Step 2 — insert: 

num is ValResult( AvgPrice, 5). 

Explanation: Get the average price 5 days ago.

Variance

Description: This function returns the quantity Variance computed for a User Defined Function as follows:

var = y (xi # xi)2 summation: i = 1, n

Where:
xi = y xi summation: i = 1, n

n = number of periods in moving average

Syntax: Variance( udf, periods, [dateoffset] )

Example: StdDev is sqrt(variance([<udf>],10,5)) 

Explanation: Get the Standard Deviation of user defined function 5 days ago using previous 10 values.

Warrant

Description: Returns TRUE if the current ticker being tested is a Warrant. Use this function to filter tickers based on a type.

Syntax: Warrant()

Example: WarrantRule if Warrant() and [er up] > 90. 

Explanation: Er > 90 only for Warrants

Year

Description: This function returns a number representing the current year.

Syntax: Year()

Example: Year is year().

Explanation: Will return 2001.00 if the current year is 2001.