The Power of Equations and Custom Metrics

June 27, 2022 Printer Friendly Printer Friendly

Introduction

In this post we’ll explore two powerful capabilities in Stock Rover; Equations and Custom Metrics.

Before jumping in, it is first important to understand the concept of “metrics”, as they are a foundation of Stock Rover. Metrics serve a dual purpose as both the input for stock / ETF research and portfolio analytics and the output for charting, showing competing investment options, viewing portfolio data, and much more.

Out of the box, Stock Rover comes with some 650+ metrics that cover areas such as growth, profitability, financial strength, capital efficiency, price performance, momentum, dividends, analyst ratings, stock ratings, industry and sector deciles, financial statement data, and more, including advanced metrics such as the Piotroski F-Score, Price to Graham Number, Shiller P/E, Margin of Safety, Beneish M-Score and the Altman-Z score.

Metrics as Input

Below, using the the Growth at a Reasonable Price (GARP) screener for our example, we show key GARP metrics being used as input for the screener filtering criteria.

  • EPS Next Year Chg (Est.%) > 8
  • PEG Trailing < 1.5
  • PEG Trailing < 1.5
  • Operating Income 5-Year Avg (%) > 8
  • Sales 5-Year Avg (%) > 4
  • Sales 1-Year Chg (%) > 4
  • EPS 1-Year Chg (%) > 8
  • EPS 5-Year Avg (%) > 8
  • Earnings Yield > 4

GARP Screener

Metrics as Output

Below we show using metrics as output, where they are displayed in the Table for comparative analysis.

The Table’s representation is much like a spreadsheet where each row corresponds to a ticker, and each column corresponds to a metric.

Table Display

Making Metrics Do More

For the vast majority of use cases, out-of-the-box metrics will do the job. You can easily browse all the metrics Stock Rover provides via the Stock Rover Metric Browser.

However, there are cases where out-of-the-box metrics may not provide the exact data an investor is looking for. Cue Equations and Custom Metrics.

Equations are used in Screeners to create more complex filtering situations. The input case we described above.

Custom Metrics are new metrics that are derived as formulas from existing metrics. Once created, Custom Metrics behave like out-of-box metrics. They can be used as input to a filtering condition in a screener, or output as a column in the Table.

Equations

What Are Equations?

Equations are formulas that are constructed from the built-in metrics of Stock Rover. Equations can reference both the current and historical values of the built-in metrics. They can also use built-in functions to aide in creating more sophisticated formula expressions.

Equations are used both in screening for more complex filtering operation, and in Custom Metrics to define how the custom metric should be computed. Both of these cases will be explained in detail in the following sections.

When Do You Use Equations?

Considering screening first, equations are appropriate when filtering based on a simple threshold won’t do. For example: The equation below compares two Stock Rover metrics against each other. The equation is filtering for tickers that are in industries that are outperforming the S&P 500 over the last month.

“1-Month Return vs Industry” < "1-Month Return vs S&P 500"

Note this equation is a bit counter-intuitive because the input metrics are each comparing the ticker to the industry and to the S&P 500. So for example if a stock is outperforming the S&P 500 by 10% and the Industry by 5%, it would mean the industry is outperforming the S&P 500 by 5%. This equation captures that fact.

Let’s take a look at more equation examples. Below is the GARP – Premium Plus screener which is available from the Investor Library.

The equations highlighted in red and listed below are filtered based on historical values. The equations referencing Earnings Per Share, Sales, and Operating Income are filtered for consecutive Trailing Twelve Month increases last year and this year.

  • “EPS[Now]” > “EPS[TTM1]”
  • “EPS[TTM1]” > “EPS[TTM2]”
  • “SALES[Now]” > “SALES[TTM1]”
  • “SALES[TTM1]” > “SALES[TTM2]”
  • “Operating Income[Now]” > “Operating Income[TTM1]”
  • “Operating Income[TTM1]” > “Operating Income[TTM2]”

GARP Plus Screener

Comparing Metric Values

The Improving Analyst Ratings Screener, which is available in the Investor Library, demonstrates the use of equations to compare metric values. This screener is filtering for stocks with increasingly favorable analyst ratings.

The screener consists of 5 equation-based filters that are each evaluating Analyst Ratings metrics against each other as follows:

  1. The Analyst Consensus Rating < The Analyst Consensus Rating as of 1 month ago.
  2. The Analyst Consensus Rating < The Analyst Consensus Rating as of 3 months ago.
  3. The current number of Strong Buy Recommendations > The number of Strong Buy Recommendations as of 3 months ago.
  4. The number of Buy Recommendations >= The number of Buy Recommendations as of 3 months ago.
  5. (The number of Strong Sell Recommendations + The number of Sell Recommendations) < (The number of Strong Sell Recommendations as of 3 months ago + The number of Sell Recommendations as of 3 months ago).

The advanced screening criteria returned 32 out of 15,231 tickers.

 Analyst Ratings Screener

Evaluating Historical Values

Stock Rover maintains history which can be used to perform time-based filtering.

The time periods that are accessible in an equation are:

  1. Quarterly data from the most recent quarter through 9 quarters ago.
  2. Trailing Twelve Month data from the most recent TTM through TTM 10 years ago.
  3. Calendar Year data from the most recent CY through 10 years ago.

Note: For a complete list of historical metrics please consult the Metric Browser where each metric is listed along with a “No” or “Yes” status for History.

The GARP Premium Plus screener, which is available in the Investor Library, demonstrates how to use a combination of threshold-based screener filters and historical equation filters to find companies that exhibit Growth at a Reasonable Price (GARP) characteristics.

The historical equations are performing time-based filtering, looking for tickers that are showing increasing EPS, Sales, and Operating Income growth:

  1. EPS > EPS Trailing Twelve Months value from 1 year ago today.
  2. EPS Trailing Twelve Months value from 1 year ago today > EPS Trailing Twelve Months value from 2 years ago today.
  3. Sales > Sales Trailing Twelve Months value from 1 year ago today.
  4. Sales Trailing Twelve Months value from 1 year ago today > Sales Trailing Twelve Months value from 2 years ago today.
  5. Operating Income > Operating Income Trailing Twelve Months value from 1 year ago today.
  6. Operating Income Trailing Twelve Months value from 1 year ago today > Operating Income Trailing Twelve Months value from 2 years ago today.

The advanced screening criteria returned 40 tickers.

 GARP Premium Plus Screener

Creating Complex Filtering Situations

The Vintage Value Investing’s Wealth Builder Screener which is available in the Investor Library, showcases how to use equations to create complex filtering criteria.

Below are examples of some of the equations used in the screener:

“EPS [Now] ” > “EPS [Y5] ” and “EPS [Y5] ” > “EPS [Y9] ”

(( “Return on Equity [Now] ” + “Return on Equity [Y1] ” + “Return on Equity [Y2] ” + “Return on Equity [Y3] ” + “Return on Equity [Y4] ” + “Return on Equity [Y5] ” + “Return on Equity [Y6] ” + “Return on Equity [Y7] ” + “Return on Equity [Y8] ” + “Return on Equity [Y9] ” )/10)>=15

“Long Term Debt [Now] ” <=(5* "Net Income [Now] " )

VVI Screener

Equation Examples

Below are more examples that show how to extend beyond simple filtering and implement sophisticated screen matching criteria with equations.

Comparing Two Metrics

We’ll start with the simplest use case for equations which is to perform a comparison between two metrics. In this instance, filtering for tickers whose last close price beats out the previous day’s close price.

Compare 2 Metrics

Evaluating History

Below is a demonstration of how to look for 3 consecutive quarters of EPS growth. We’ve also added a bit more math to the equation to ensure the filter returns an EPS growth rate of at least 20% per quarter.

Equation with History

Boolean Logic

Here we’ve changed our approach using Boolean logic. We are filtering tickers where the EPS for the most recent quarter exceeded 1 quarter ago by 20% and EPS of 1 quarter ago exceeded two quarters ago by 10%.

Boolean logic

Equation Functions

In an equation, you can use numbers, arithmetic operators (+ – * /), comparison symbols (>, <, >=, <=, !=, =), Boolean operators (e.g. and, or), functions, and parenthesis for proper nesting. There are also equation screener functions which takes filtering to the next level.

For example, Stock Rover maintains history for the Tangible Equity Per Share metric going back 10-Years, but not the compound annual growth rate. What if we wanted to filter on a CAGR > 10%?

The equation below is shown in the Equation Editor, This example is using multiple equation functions to filter and return tickers where the Tangible Equity Per Share grew at a compound annual growth rate of at least 10% over the last 7 years.

  1. The first part of the equation returns a null value on negative growth.
  2. The equation is taking the change in value between the tangible equity per share now and the tangible equity per share from 7-years ago and then using the pow function to calculate the growth rate.
  3. The last part of the equation allows only tickers with a CAGR of at least 10% to filter through.

Equation Screener

Creating an Equation

Now that we have a better understanding of what equations are and when to use them, let’s explore how to create an equation.

First, a quick explanation of the Screener Manager. As its name implies it is where Stock Rover’s Screener management functions reside. From here we can chart a screener, use a screener to score a watchlist, import screeners from the Library, and much more.

Screener Manager is also where we can create our own screeners, either by modifying pre-built screeners or by building our own custom screeners from scratch.

In the example below we are going to build a screener from scratch that will consist of a single screener filter that is in the form of an equation.

The screener is going to filter for tickers with a quarterly Sales increase. The filter will only let tickers through where the Sales for the most recent quarter exceeds the quarterly Sales value from 1 quarter ago.

The finished equation will look as follows:

“Sales [MRQ]” > “Sales [Q1]”

Step 1: Launch Screener Manager

We are going to launch the Screener Manager and tell Stock Rover that we would like to create a new screener. The Screener Manager will then expose the Create Screener pane where we can add the appropriate filtering criteria.

  1. Launch the Screener Manager by selecting “Screeners” from the grey Start menu.
  2. Select “Create a New Screener” from Screener Actions.
  3. From the Create Screener pane select a filter to add.
    • From the Create Screener pane we can create filters using any combination of these options:
       

    • Add Criteria – select to create a basic screener filter
    • Add Free Form Equation – select to create an equation

Equation Screener

Step 2: Select the Equation Editor

Clicking on the “Add Free Form Equation” button launches the Equation Editor.

Add Free Form EquationStep 3: Build the Equation

We want our equation to start with the metric for Sales.

As Stock Rover maintains some 650+ metrics – we’ll go to the search box under “Metrics and Functions” and search for the desired metric.

The search returned a number of sales-related metrics along with their descriptions – we’ll select “Sales” which is highlighted in blue from the list.

Select Metric

When a metric that has history is selected it will appear along the top next to the “Test” button as well as in the editor. Only metrics with history appear next to the Test button.

The editor is showing “Sales[Now]” as the first part of our equation. Sales[Now] represents the total sales over the past 12 months.

We want the Sales for the most recent quarter value, so we’ll click on the edit button to change the metric to reference the desired time period.

Equation Screener

We can now select the time period for the first part of our equation.

History can be selected as follows:

  1. Quarterly data from the most recent quarter through 9 quarters ago.
  2. Trailing Twelve Month data from the most recent TTM through TTM 10 years ago.
  3. Calendar Year data from the most recent CY through 10 years ago.

Equation Screener

  • The metric in the equation changed to “Sales [MRQ]” which is the Sales for the Most Recently reported Quarter.
  • We then typed >

Equation Screener

To build the second part of the equation we’ll repeat searching for and selecting Sales.

We’ll then edit the time period and choose the time period from “1 Quarter Ago”.

Note: When you are comfortable with the syntax you can also simply type freeform into the Equation Editor.

Equation Screener

Below we see that the equation “Sales [MRQ]” > “Sales [Q1]” has been created.

Clicking the Test button verifies the equation syntax is correct.

We tested using IBM – and see the Most Recent Quarter and 1 Quarter Ago values displayed and no errors.

Once we’ve added the filter we can confirm by clicking “OK”.

Equation Screener

Step 5: Add the Equation to the Screener

The equation filter is now added to the Screener.

We can repeat the process to add more filters to the screener via “Add Criteria” and “Add Freefrom Equation” and when we’re done “Save” the Screener.

Equation Screener

Custom Metrics

What Are Custom Metrics?

Custom Metrics allow you to use equations to create your own custom calculation format based on existing metrics.

When Do You Use Custom Metrics?

Compute Something New

Use multiple metrics to compute a new metric.

The metric “Return vs. Drawdown” provides a sense of the risk/reward characteristics of an investment based on the trailing twelve-month return and the maximum drawdown over 5-years.

Return vs Drawdown

Compute Using Historical Data

Use history to display or compute a new metric.

Here we are looking at the ROIC and using the history to compute the average over the last 3 years.

The metric “ROIC vs. 3 Year Average” is showing how ROIC is faring relative to the last 3 years.

ROIC vs 3 Year Average

Display a Complex Filtering Condition in the Table

Perform comparative analytics.

Here, the ROIC vs. 3 Year Average metric has been added as a column to the Profitability View.

Custom Metric in the Table

Reference a Complex Filtering Condition in a Screener

Quickly reference Custom Metrics in the Screener Manager just like any out-of-the-box metric.

For example, the filtering criteria can be based on a Custom Metric’s threshold as in the example below with the ROIC vs. 3 Year Average metric.

Custom Metric in the Screener

Creating a Custom Metric

A common use case for Custom Metrics is to display the computed metric value as a column in the Table for comparative analytics. Custom Metrics can display historical data or a complex filtering condition.

Step 1: Launch Custom Metric facility

The Custom Metric facility is accessed via the Actions pull-down in the Table, where we select “Create Custom Metric”.

In the example below we are going to create a Custom Metric that will automatically be added to our current view “EPS by Quarter” which we have highlighted in blue.

Keep in mind, that once a Custom Metric is created it can be added to any other View(s).

create custom metric

Step 2: Select a metric to reference in the Custom Metric

In our example we want to display the EPS value from 8-quarters ago in our Table.

We’ll first enter EPS in the search box that is located under Includable Metrics.

We see that a number of EPS-related metrics along with their descriptions are returned – we’ll select “EPS” which is highlighted in blue from the list.

custom equation editor

Step 3: Build and Test the Custom Metric

As we want our Custom Metric to display in dollars and cents, we’ll first change the “Display Format” by selecting it from the pull-down.

The Custom Metric equation syntax is identical to that of Screener equations.

When a metric that has history is selected it will appear along the top next to the “Test” button as well as in the editor. Only metrics with history appear next to the Test button.

The editor is showing “EPS[Now]”. EPS[Now] represents the EPS over the past 12 months. However, we want the EPS value from 8 quarters ago, so we’ll click on the edit button to change the time period.

create custom metric

We’ll select “Quarters” and “8 Quarters Ago” and then click OK.

edit custom metric

We can see our metric is now referencing EPS[Q8].

Selecting “Test” verifies the equation syntax is correct. We tested using the ticker APPL – no errors and a value of 64 cents was returned.

Once you are comfortable with the equation syntax you can also type freeform into the Custom Metric facility. In addition, this guide is a good resource when creating a Custom Metric.

create custom metric

The Custom Metric has now been added automatically as a column to the front of the View.

display custom metric

You can rearrange the columns to display in an order that best suits your requirements. In this instance, we did a drag and drop of the “EPS 8Q Ago” column heading and moved it to the end.

The custom View below consists exclusively of Custom Metrics and now is displaying the EPS change from the previous quarter as well as the EPS values for each quarter going back 8-quarters.

Custom EPS View

Adding to the Table

Once a Custom Metric is created it can be added to any View just like any other metric by selecting Add Column from the Table.

It is as simple as browsing for the Custom Metric and adding it.

In the example below we searched for “Q Ago” and then added the custom metric called “EPS 1Q Ago” as a column to our view.

Custom Metrics can be added to any of the views – be it a custom view, a default view, or any views imported from the Investor Library.

add column

Filtering a Screener

Custom Metrics can be referenced in a Screener to provide complex filtering.

If you have a complex filtering condition that you are likely to reference repetitively, it is best to turn the filter criteria into a Custom Metric and reference the Custom Metric in the Screener.

In the example below the results of the equation:

pow(case when ( “Tangible Equity Per Share [Now] ” / “Tangible Equity Per Share [Y7] ” )  <= 0 then null else ( “Tangible Equity Per Share [Now] ” / “Tangible Equity Per Share [Y7] ” ) end, 1/7)-1

is used to create a metric called “7-Year Tangible Equity Growth”.

The metric is returning the compound annual growth rate of the Tangible Equity Per-share over a 7-year period.

Equation Metric

We are going to launch the Screener Manager and create a new screener that uses “7-Year Tangible Equity Growth” as its filtering criteria.

  1. Launch the Screener Manager by selecting “Screeners” from the grey Start menu.
  2. Select “Create a New Screener” from Screener Actions.
  3. The Create Screener pane is where we’ll add the filtering criteria

Equation Screener

We’ll click on the Add Criteria button, select our Custom Metric, and filter on a simple threshold of:

7-Year Tangible Equity Growth > .20

We can see that 212 tickers met the filtering criteria of our Custom Metric.

Filtering a screener

Displaying Metric History

Throughout this blog we’ve shown how to use Custom Metrics to display metric history as columns in the Table. This is an excellent technique when you are performing historical analysis across tickers in the Table.

You can also leverage Stock Rover’s out-of-box analytics for comparative analysis including:

  • Charting – allows you to comparatively chart over 100 fundamentals. You can also perform benchmark comparisons, chart valuation, technicals and much more.
  • Historical Data – shows metric history for a selected ticker directly from the Table.
    Simply right-click on a row and choose “Historical Data”. Below is the history for the metrics shown in the Valuation View for the ticker ARCB.

Historical Data

Summary

While Stock Rover certainly comes with an impressive list of capabilities including some 650+ metrics, you are not limited to using the metrics “as is”.

You can tailor Stock Rover to address even the most specific requirements via Equations and Custom Metrics.

Equations:

  1. Filter based on history with Quarterly, Trailing Twelve Month, and Yearly values
  2. Use equation functions to create highly specific filtering for sophisticated screen matching criteria

Custom Metrics:

  1. Turn your equation results into Custom Metrics
  2. Display Custom Metric values in the Table as part of your analytics
  3. Use Custom Metrics as filters in Screeners



Comments

Jacques Hennequet says:

Thank you for this information. Can equations be used and metrics created that refer to the charts, such as 50 Day Moving Average >= 200 Day Moving Average?
Thank you.

Ken Leoni says:

Hello Jacques,

Yes, you can incorporate technicals into an equation

“SMA 50” >= “SMA 200”

To see the list of technicals supported in equations, launch the Metric Browser and then filter on the folder “Technical Indicators”

Regards
Ken

Charles Williams says:

Great information on the screening capabilities of Stock Rover.

But, the program is tedious and time consuming to use.

Also, I have never been able a way to screen for moving average crossovers.

Ken Leoni says:

Hi Charles,

We don’t support screening for moving average crossovers, but this is something that we are going to give some more attention to in the future.

Regards
Ken

Leave a Reply

Your email address will not be published.

We value your privacy and will not display or share your email address

This site uses Akismet to reduce spam. Learn how your comment data is processed.




Top