Creating Advanced Stock Screens Using the ‘Or’ Function and ParenthesesDownload printable PDF
Arguably the most difficult task for new users of Stock Investor Pro is setting up a custom stock screen with their own filters. Filters allow you to apply comparison statements to the entire universe of stocks (or a subset such as a portfolio) in order to isolate those stocks that match your desired criteria. In the October 2013 issue of Stock Investor News, we explained how to create basic custom screens. This issue finishes the discussion by showing how to apply two advanced features when screen building: the ‘or’ function and parentheses.
Share this article
How the ‘Or’ Function Works
The ‘or’ statement and the parentheses are perhaps two of the most underutilized or misused functions in Stock Investor Pro’s Screen Editor. If used properly, these functions can save you from having to repeat expressions in your screen, thus making the screen less cumbersome. However, if used incorrectly, they can have an adverse effect, leading to incorrect and perhaps misleading screening results.
The best way to illustrate the use of these functions is by looking at an example. Custom Screen 1 looks for companies in relatively similar industries, electric utilities and natural gas utilities, so that you are comparing apples to apples. To create these first two lines, simply select ‘Industry’ from the Company Information category for the Field cell, select ‘Equals’ for the Operator cell, and select the appropriate industry in the Compare to cell. Note that an ‘or’ connector is used to combine the two criteria. By default, ‘And’ appears in the Conn column, so you will need to click on ‘And’ and change it to ‘Or.’
Additionally, we want to identify those electric and gas utilities whose price-earnings multiple has not outpaced the sum of its earnings per share growth rate and its dividend yield. This figure is an indication of the valuation by the market relative to a company’s historical earnings growth and dividend yield. In other words, we are searching for companies that have gotten cheaper relative to their dividend-adjusted earnings growth over the past five years. For this criterion, we select PE to Div adj EPS growth 5yr for the Field cell, the ‘less than’ symbol for the Operator cell and ‘1’ for the Compare to cell. Lastly, we want to see which electric and gas companies also rank among the top 10% of all the companies in the database in terms of dividend growth over the last five years (% Rank-Dividend-Growth 5yr >= 90).
Custom Screen 1 uncovered 100 companies (as of January 17, 2014). Upon further investigation, however, you may question the fact that this is over 67% of the maximum number that could pass. We know this because the Screen Editor shows in the Count On column that there are 147 companies in the electric (98) and natural gas (49) utilities industries combined. This is a red flag that there may be a problem with how the screen was constructed, so we need to examine why the screen produced these results.
The Screen Editor looks at all expressions before an ‘or’ statement and performs a screen. The results of that sub-screen are then set aside, and the editor continues on, screening those expressions that contain the ‘or’ statement and all those thereafter. If there are additional ‘or’ statements contained within the screen, it will perform additional sub-screens and set the results aside. When the entire screen has been performed, the Screen Editor then combines together those companies that passed each of the sub-screens to arrive at the total number of passing companies.
Referring back to the first criterion statement in Custom Screen 1, 98 companies are part of the electric utilities industry. Since it is before an expression with an “or” statement, this result is set aside. At this point, therefore, 98 companies will pass the entire screen. Two companies pass the portion of the screen after the “or” connector: natural gas utilities with a low price-earnings ratio to earnings growth and that rank high in dividend growth. Adding the 98 companies that passed the first portion of the screen to the two that passed the second portion, we arrive at the 100 companies that pass the entire screen. An adjustment needs to be made to the screen so that all electric and natural gas utilities are filtered against the final two criteria. This is where parentheses come in.
The idea behind the use of parentheses in the Screen Editor is the same one you may have learned in a basic algebra class. Just as in a mathematical expression, the items contained within the parentheses are evaluated first. Those companies passing the screen contained within the parentheses are then screened against the remaining criteria. Typically, you will use parentheses in conjunction with ‘or’ statements.
Custom Screen 2 shows parentheses added at the beginning and end of the two industry criteria connected by the ‘or’ function. The result is a dramatic drop in the screen outcome: Only five companies pass the screen. Using the logic discussed above, the Screen Editor first performs the screen on the statements within the parentheses, screening for those companies in the electric or natural gas industries. The 147 companies that remain (those that are either in the electric utilities or natural gas utilities industries) are then screened against the last two criteria, with five remaining when the screen is complete. This is the intended result.