Equation Screener Functions and Examples

Equation Screener Examples:

Listed below are three examples of using equations in the Stock Rover Screener. Note that the tag inside the brackets indicates the time period to use for each metric in the expression. For example, Now refers to the most current trailing twelve month period. TTM1 refers to the trailing twelve month period one year ago, so 12 month prior to the Now period. Likewise TTM2 refers to the trailing twelve month period two years ago. Y2, which is used in the second example refers to the calendar year two years ago.

Ensure ROIC Improvement

( “ROIC [Now] ” > “ROIC [TTM1] ” ) and ( “ROIC [TTM1] ” > “ROIC [TTM2] “)

Ensure Share Count Not Growing Too Fast

“Diluted Shares [Now] ” <= ( "Diluted Shares [Y2] " * 1.02)

Ensure Debt Reduction

( “Long Term Debt [Now] ” <= "Long Term Debt [TTM1] " ) and ( "Long Term Debt [TTM1] " < "Long Term Debt [TTM2] ")

Equation Screener Functions

Here is a list of functions available in the custom metric and equation screener facilities:

**Note: The functions are case sensitive and must be written in lower case

Function Name Description Example
abs Returns the absolute value of value abs(-1.5) returns 1.5
case when then else end This function lets you evaluate conditions and return a value when the first condition is met (like an IF-THEN-ELSE statement) case when x > 0 then 1 else 0 returns 1 if x is greater than 0 otherwise it is 0.
exp Return e raised to the power of number exp(2) returns 7.38905609893065
ifnull Returns the second value if first value is null. ifnull(null,0) returns 0
A Stock Rover example if you want to find companies that have good long term returns but have not existed for a long time you can use an example like this:
ifnull(“Annualized 10-Year Return”, “Annualized 3-Year Return”) > 10
null A special term for values that unavailable or not applicable. Metrics will commonly evaluate as null when trying to compute a growth rate of negative values or when comparing historical values that go further back than the stock’s history. null can be used within the nullif and ifnull functions
nullif Returns null if the first and second are equal otherwise it returns the first value. nullif(5,5) returns null
pow Returns the value raised to the nth power pow (8,3) returns 512
A Stock Rover example to get the 5 yr eps growth rate:
100 * (pow(case when “EPS [Now]” / “EPS [Y5]” <= 0 then null else "EPS [Now]" / "EPS [Y5]" end, 1/5) - 1)
Please note, the case statement is used within the pow function because the pow function does not accept negative numbers.
round Returns a number rounded to a certain number of decimal places. round(345.156, 0) returns 345

Using POW when Negative Numbers need to be Ignored

In this example, we want to take the square root of a number, but the POW function only accepts number greater than or equal to zero. So to ensure the number we pass to POW is positive, we use a Case statement inside of the POW function. It is a little tricky, but it does the job. The formula is as follows:

100 * (pow(case when “EPS [Now]” / “EPS [Y5]” <= 0 then null else "EPS [Now]" / "EPS [Y5]" end, 1/5) - 1)