What you can find here:
- Fundamental strategies screen modeling;
- Technical analysis strategies screen modeling.
Fundamental screening strategies
Here’s an outline of the fundamental screening framework:
- Start your screen with some sort of liquidity framework. This could be as simple as a rule that says Universe(NOOTC), which omits all pink-sheet stocks, or a volume test like this: AvgVol(60)>=150000, which means the trading volume over the past 60 days must have averaged at least 150,000 shares. Other possibilities include close(0)>=5, which limits consideration to stocks whose latest price was $5 or higher, or MktCasp>=100, which means market cap must have been greater than or equal to $100 million.
- Needless to say, you can combine several rules like these
- You don’t actually have to use screening rules to manage liquidity, but we haven’t yet covered the other approach, Universes. So for now, handle it through screening rules.
- Decide how you would like to classify different parts of the equity universe – define different styles
- Large cap, mid cap, small cap
- Growth, value
- Decide how you would like to define the kinds of companies you want. Do you want companies that meet numeric thresholds, or rank well relative to industry peers, sector peers or the market as a whole
- Decide which style(s) you’d like to focus on, or if you want to pursue a generalist approach, make a knowledgeable decision to that effect
- Make this the focus of your screen
- Decide how you’d like to narrow down to your final selections
- Usually, this will involve a style different from that of your primary focus
- Often, it will be generalist in nature
- This could be implemented by some additional screening rules
- On Portfolio123, you may choose to implement this using the Quick Rank or a pre-defined ranking system
Some investors have a preference when it comes to company size and will want the stocks they see to be large cap, mid cap, small cap, or micro cap. It’s very easy to add such a preference to your screen. Just include a rule requiring market capitalization (MktCap) to be greater to or less than your preferred threshold.
If you want to bound both ends of the range, use an AND statement in your screening rule. For example, if you want small companies, but not too small, do something like this:
MktCap>=250 and MktCap<=1000
That limits consideration to stocks with market caps between $250 million and $1 billion. If you check the description of the MktCap factor, you’ll see that it is defined in terms of millions of dollars. So six zeros will always be added, behind the scenes, to any number you specify.
If you are inclined to think in terms of market cap categorization, here are some things to keep in mind:
- The more your focus gravitates toward larger companies, the harder you’ll have to work to create screens that succeed. Larger companies tend to be covered by more analysts and talked about more intensely in the media, resulting in much more share price action being sparked by noise and chatter rather than by objective fundamentals. This is not to say larger-company screens can’t work – they can – but be prepared to work a lot harder and backtest more vigorously.
- Be vary careful about stereotypes. Many believe big companies are inherently safer. Try creating screens on that basis and backtesting. You’ll see that often, it’s not so. Others assume that smaller firms will have stronger growth characteristics. That, too, may turn out to be just a stereotype. Often small-stock appeal is based on the potential for growth that hasn’t yet fully materialized in the past (and hence won’t be visible in historic growth factors).
I suspect most who screen tend to be agnostic when it comes to size. They create the best screens they can and, as long as liquidity considerations are satisfied, accept whatever size companies appear. The classifications that occupy most attention tend to be stylistic: Growth, Value, etc.
As important as it was to steer clear of stereotypes when it came to size, it may be much more so when it comes to style since this is an area where stereotypes attract, perhaps, the most passion. Here is the big secret when it comes to style: They can all work if executed well, and they can all hurt you if executed badly.
Don’t take my word for it. You have a powerful backtester at your disposal. Put it to work. Notice, as you experiment, that value is not inherently most prudent. Notice that growth is not inherently speculative. Notice that companies with debt are not inherently riskier. Etc., etc., etc.
Look, too, at the world around you. How is it possible that Ben Graham and Warren Buffett on the one hand and William O’Neil and Jim Cramer on the other hand can all succeed over prolonged periods, even though they fall into stylistic camps that seem hopelessly opposed. In truth, when it comes to what’s important, they aren’t opposed at all: they are all united in being excellent when it comes to implementing the styles they chose to pursue.
If you wish to be agnostic when it comes to style, to create a screen that has a little of this and a little of that, you certainly can do that. But even though all styles are valid, it can still be a good idea to have a focus. That’s because different styles will attract stocks having different characteristics and it’s important to gravitate toward those that best match your own temperament and risk-reward preferences.
We’ll discuss the styles further when we get to Primary Focus. But before going there, we need to address one more preliminary topic.
Do you want good companies or good stocks?
This is not a trick question. They are not necessarily the same, and each has its own merits.
Look at the Style–Specific pre-defined screens. Notice that each style features four kinds of screens:
- Basic – This is where numeric criteria are used the establish thresholds. An example would be a requirement that a five-year average annual growth rate be above 25%.
- Compared to Industry Peers – An example might be a requirement that companies have growth rates that rank in the to 35% relative to industry peers. A company could pass the screen if its earnings were falling, so long as the decline was less steep than those of most others in the industry. A variation of this would use sector, rather than industry, comparison,
- Compared to Market – This is similar to industry/sector comparison except that here, we’d be looking at how companies rank relative to all others regardless of industry/sector
- Comprehensive – This is a demanding approach that requires companies to fare well in chosen factors when measured relative to both industry/sector and the market as a whole.
Basic is the easiest concept to grasp and the one most familiar to novice screeners. It can point the way toward good companies and/or good stocks depending on which factors you use.
- It’s strength is not so much in simplicity (just because something is easy doesn’t mean it’s good) but in the fact that the user is establishing a certain minimum threshold below which he will not go under any circumstances. To pursue this approach, you must be willing to accept a screen that would produce a very small number of results, perhaps even none, under certain conditions.
- The drawback lies in the difficulty in establishing reasonable thresholds. For one thing, standards are not absolute. Who is to say that a 25% growth rate is really more deserving of notice than, say, 15%-20% which, when viewed realistically, would be seen as being pretty darn good? There was once a time when it was reasonable to look for P/Es below 8 (as Ben Graham used to do); nowadays, a threshold like that will most likely confine you to sticking with all cash except for occasions when you get to consider companies whose earnings are about to fall off a cliff, and probably drag the stock prices down with them. This is not to say you should never use Basic thresholds. But if you use them, do not be blasé about your numeric tests. Consider how you would defend them if challenged.
Peer (Industry or Sector) Comparison is a classic good-company approach. When it comes to numbers, you’re willing to accept anything so long as the company is “better” (the standard being defined by you) than other companies similarly situated.
- The strength of this approach lies in its ability to uncover company excellence. Many investment gurus and authors say much about evaluating management. In the real world, you’re not going to be able to do it. (In the extremely unlikely event you can get access to key decision makers, federal law limits the extent they can communicate specially with you and unless the company is in the same field as the one in which you’re professionally active, you probably wouldn’t be able to properly evaluate whatever tidbits on information happen to fall your way.) The good news is that talented corporate management teams tend to leave “financial footprints of success.” These are visible where companies are able to consistently post better results than other firms that are similarly situated (i.e. the cyclical firm whose earnings fall five percent in a downturn while peers experience declines averaging 20 percent).
- The bad news is that in the day to day world of Wall Street, true talent is not always rewarded. Gurus and authors suggest that stock market success can be achieved by focusing on great companies. That’s not necessarily false. But however well good companies are reward in terms of stock market strength, never underestimate Wall Street’s willingness to also favor ordinary, mediocre, and sometimes downright rotten companies as well, often for prolonged periods. Going back to the cyclical-company example, the better firm’s stock might, during a recession, get slammed about as much as all the others in its industry. The case for investing would lie in the likelihood that it will really soar when its excellence becomes manifest during a recovery. The good-company investor reasons that it’s tenuous to try to time top-down circumstances, and that the best course of action is to simply load up on corporate excellence and, if necessary, wait a bit.
Market comparison, where you look for situations where a company ranks well compared to all others, looks like a good-company approach but actually has a much stronger good-stock element than many realize.
- The good-company flavor appears from the fact that it relies on comparison, rather than numeric thresholds. We want companies that are “better.” Realistically, though, you’ll often find your results weighted toward companies in businesses that are presently hot. The way-better-than-average cyclical company is probably not going to make it into your screen when business conditions are weak. It’ll probably get nudged out by ordinary or mediocre companies that happen to be in currently stronger less-cyclical businesses.
- Market scholars would like to think Wall Street should be able to see through this sort of thing. Don’t count on it. Investors can be remarkably short sighted and often wouldn’t blink at favoring a shares of a mediocre company in a hot industry over those of an excellent firm in an out-of-favor business. Pursuing the latter can still be a fine strategy. (Peter Lynch made a great living doing that!) But there’s no shame in making money riding current Wall Street waves.
Comprehensive comparisons are the superheroes of screening tests. These are for investors who want it all; corporate excellence and the forefront of Wall Street waves.
- On paper, these are, hands down, the best tests you can create. That should be obvious.
- In reality, don’t assume such screens will always deliver. There is a lot of imperfection in the world and Wall Street has tremendous tolerance for flaws. The more you demand, the more exciting opportunities will, due to imperfections, fall by the wayside.
- Think of comprehensive comparisons as being like hot peppers. A dash here and there can do wonders for what would other side be an ordinary meal. But you definitely don’t want to overdo it.
Portfolio123 offers two ways to implement comparative screening.
The easy way to use the collection of industry-average factors (in the free form interface, these can be found under INDUTRY FACTOR. The general approach would be to compare companies to industry average. Here’s an example involving a five-year EPS growth rate:
The pro, here, is simplicity. Such rules are easy to create. The con is restrictiveness. You can’t engage in market or comprehensive comparison, nor can you do much beyond seeking companies that are better than average.
Portfolio123 functions offer more power and flexibility for those willing to deal learn to use the functions. These can look very intimidating at first, but once you get used to them, they are quite manageable. If you haven’t yet looked at the Functions section of this tutorial series, please make a point of doing so before going on with this section.
The function most likely to be used for comparative screening is FRank. It has one mandatory parameter followed by three optional parameters.
The mandatory parameter is formula/factor, which must be enclose in quotes. This is obvious. Portfolio123 can’t rank anything until you tell it what it is that you want it to rank.
If you want to rank companies based on five-year EPS growth, your function would look like this:
Upon seeing that you omitted the optional parameters, Portfolio123 would fill them in with default entries. It would assume you want EPS5YCGr% ranked relative to all stocks (that you are aiming at market comparison) and that you want the sort to be descending, meaning high numbers are good.
I very strongly suggest you get into the habit of always using the first two optional parameters. Express the function this way:
The first optional parameter, #all in this case, is where you tell Portfolio123 what kind of comparison you want. Alternative entries could be #industry or #sector.
Suppose you aren’t looking to rank growth rates. Suppose you want a factor where low numbers are more bullish than high numbers, such as P/E. In that case, the default value for the first optional parameter definitely will not work. You would need to ask Portfolio123 to do an ascending sort by stating the parameter as #asc.
Suppose you want a market comparison and an ascending sort. Might you do this?
That specifies an ascending sort. You leave out #all because it’s a default value that will be presumed by Portfolio123.
That would produce an error message. Remember, from the Functions section of the tutorial series, that each parameter must occupy its assigned position. After the formula, Portfolio123 expects to see #all, #industry or #sector. You have to push #asc into its proper position by using one of the comparison specification. So a correct way to specify the function would be:
So a screening rule involving PE comparison might look like this:
The 75 value is a percentile score with 0 being worst and 100 being best.
For now, don’t worry about the last optional parameter. Once you get comfortable with Universes, a topic that will be covered later, it will become more meaningful.
Articulate some sort of primary stylistic focus. You’ll have plenty of opportunity to flesh it out later. But it’s important to start somewhere. There are many screening factors available in Portfolio123. Once you articulate a stylistic focus, you’ll find it easy to zero in on the ones most relevant to you.
There are no hard and fast rules for categorizing styles. Here is an approach that’s worked pretty well for me.
This style emphasizes historic rates of growth.
Don’t fall for the intellectual snobbery that often arises in response to growth stocks, which tend to be dismissed as aggressive or even speculative. Actually, though, growth is an important element and one that is conspicuously included in every academic valuation formula. Without growth, there’s no reason to ever buy stocks since bonds yield more and feature less price risk.
EPS growth is the primary target, but don’t ignore sales growth. If sales aren’t growing, it will be difficult and ultimately impossible to keep earning moving ahead for a long period of time.
Theorists place great emphasis on long-term growth rates, which demonstrate sustainability. That’s fine. Use these. But don’t ignore short-term time periods. Wall Street isn’t at all shy about rewarding flash-in-the-pan situations, and if you rebalance frequently (every four weeks or so), this can work well.
Once again, don’t fall prey to snobbery regarding low low low PEs, etc.
The days when low PEs prevailed because investors didn’t know better are history, along with the pocket-size S&P sock Guides that were as valuable to a prior generation as Yahoo! Finance is today. Nowadays, assume everybody knows about the low metrics. The job of the modern value investor is to figure out why the Street is willing to leave the metrics at low levels, and to look for a reasonable basis to disagree. Value investors today should spend no more than minutes looking at price ratios (these are obvious and easy to ascertain) and hours evaluating the companies. So if you build a value screen, be especially attentive to our subsequent discussion of Secondary Focus.
Obviously, this style emphasizes dividend yield. Naturally high is good.
Once again, though, always assume the Street knows what’s going on. If you see an especially high yield, look for a reason for why investors might be reluctant to bid up the stock. Often you’ll find something involving dividend security, a meaningful risk that adverse developments may cause the dividend to be reduced or eliminated.
Conversely, look for reasons why some yields are lower than others. Often, this will have something to do with dividend growth. The higher the rate of dividend growth, the lower the current yield is likely to be. This is an important consideration. Few income stock purchases can be justified based on yield alone; you’d usually do better with bonds. Growth is where income stocks get their edge.
This is where you get to apply all the principals you learned reading about Warren Buffett, Ben Graham, etc. You want good margins, good rates of turnover, strong returns on capital and healthy balance sheets. This is the penultimate good-company approach.
If you’re taking an investment class and want to discuss the stocks you found, Quality will point you to examples you can brag about. Remember, though, Wall street is quite happy rewarding mediocrity. So be sure to pay attention to the need for a Secondary theme.
This is the penultimate good-stock approach. Sentiment-oriented investors could care less about the underlying merits of a company. If there are none, that’s OK, so long as the Street likes the firm for whatever reason, or even for no reason. If there are some reasons but the Street’s view of them is exaggerated, that’s OK too, so long as it’s willing to act on its erroneous belief.
Notwithstanding an army of know-it-alls who are only too happy to wag their fingers in response to Sentiment investing, the fact remains that you can prosper very handsomely through this sort of thing. Test it. Build some Sentiment screens and backtest.
But be careful. There are few things the Street hates more than realizing the error of its ways. You don’t want to be caught holding shares of a beloved growth company when the day finally comes that the Street figures out that the business isn’t really all that great. It may not happen for months or years. But sooner or later, it will probably happen. If Sentiment is your primary style, rebalance quickly, every four weeks or more often. Also consider and especially solid Secondary Focus.
By now, you may have noticed an important common theme: Ignore stereotypes! Wall Street is far more varied than many give it credit for being. Approach screening with an open mind.
After reading the prior section, it should by now be apparent why you should want your models to incorporate at least one additional style. All of them are interesting. All of them can make money for you. But all of them come with their own drawbacks.
Also, since no single style has a monopoly on merit, there really is no reason to lock in on just one. If you are a diehard Quality investor but things went awry and you wound up quickly doubling your money based on the emergence of some Sentiment factors, would you really be upset? Stylistic purity works best on a soapbox. When it comes to succeeding in the market, flexibility tends to be more useful.
There are two ways to incorporate a secondary focus.
- Obviously, you can do this by adding additional screening rules to reflect one or more additional styles (don’t be afraid to go so far as to wind up with a generalist screen).
- Alternatively, you can stick with a single-style screen and add variety through a Quick Rank and/or a Ranking System.
Translating Ideas Into Screens
For fundamental screening, you’ll look primarily to the first folder "Fundamentals".
INDUSTRY FACTOR, another useful grouping, offers pre-calculated industry averages for many items in the STOCKFACTOR grouping. If you’re going to make comparisons using FRank, you will place the appropriate stock factor(s) in the first parameter position.
Most of the STOCK FACTOR categories are easily recognizable. Here, however, are some thoughts on especially useful items.
- PRICE & VOLUME
It’s tempting to go to the PRICE & VOLUME section of the FUNCTIONS are for the increased flexibility it provides, including its ability to specify daily pricing. But don’t underestimate the usefulness of taking a step back and seeing how things evolve given the passage of a little bit of time. I often use Pr4W%Chg, the share price percent change over the past four weeks, and compare this to the industry average (Pr4W%ChgInd) to get a sense of general market sentiment.
- DIVIDEND INFORMATION
Yield and Yield5YAvg are important items. But be careful about being too demanding. High yields are associated with often-justified concerns about dividend cuts. Be willing to set maximum limits on the yields you’ll consider.
- SHARE RELATED ITEMS
MktCap is an obvious choice if you want to consider issue size. You can use ShsOutAvgTTM and ShsOutAvgPTM (PTM means Prior 12 months) to look for recent share buybacks. If liquidity is a concern, you can use Float.
- EARINGS ESTIMATES
Opinions vary widely about Wall street analysts and the way they work, but like them or loathe them, there's no getting around the fact that many institutional investors move large amounts of money based on their estimate changes and recommendation changes. You'll find plenty of opportunities going with the flow, and also on the contrarian side (selling on upgrades and vice versa). Either way, it's worthwhile to pay attention. I work with estimates (CurFYEPSMean for example), where those estimates stood at various points in the past (e.g., CurFYEst4WkAgo), AvgRec (Average Recommendation: Thomson Reuter's score reflecting an aggregation of all recommendations with 1.00 being most bullish and 5.00 being most bearish) and where AvgRec stood at various points in the past. Look, too, at LTGrthRtMean, the consensus Wall Street Long-Term EPS growth rate forecast and revisions thereto.
- VALUATION RATIOS
P/E is, of course, the dean of this category. Just make sure you check the factor definition, since there are several different ways of reporting EPS. One of the key versions is PEExclXorTTM. You recognize PE and TTM. The middle part of the acronym, ExclXor, means that the EPS number used in the calculation excludes extraordinary items. Be sure to check definitions of PEG (P/E to Growth rate) as well; besides different ways to compute EPS, there are different growth measures that can be used. Look, too, at Price/Sales (Pr2SalesTTM) and Price/Book (Pr2BookQ). I'm less enthusiastic than I once was about the cash flow ratios (those non-cash allocations criticized by many actually reflect an effort to match revenues incurred over the course of many quarters with expenditures incurred in a single quarter; the effort is admittedly imperfect, but ignoring it altogether can lead to very distorted pictures of overall company economic performance), but they're there if you want them.
- GROWTH RATES
Sales and EPS are my favorites. But guard against being too demanding. In the real world, the higher the growth rate, the more likely it is that deceleration, perhaps a sharp drop-off, is just around the corner.
- FINANCIAL STRENGTH RATIOS
DbtLT2EqQ (Long-term debt to equity in the latest quarter) and DbtTot2EqQ (total debt to equity) are standards. Sometimes I compare the latest quarterly figures with PYQ (prior-year quarter) tallies. Look too at the liquidity items, CurRatioQ (current ratio) and QuickRatioQ (quick ratio) and IntCovTTM (trailing 12 month interest coverage ratio). This is also where you can find various measures of payout ratio.
- EFFICIENCY RATIOS
Turnover ratios are among the least glamorous but can be quite valuable: AstTurnTTM (trailing 12 month asset turnover), RecTurnTTM (receivables turnover), and InvTurnTTM (inventory turnover).
- PROFITABILITY RATIOS
This group, too, doesn't get nearly as much attention as it deserves. But that's probably a good thing in that inadequate attention creates opportunities for those who are looking. Return on Equity (ROE%TTM and ROE%5YAvgInd) is the main textbook measure, but I prefer Return on Investment (ROI...), which factors out the impact of debt financing on business performance (you need a good COO to have a good ROI but a mediocre business can produce a great ROE as long as you have a smart CFO; and frankly, I prefer companies whose prowess is supported by something more than an aggressive or brilliant CFO).
- INSTITUTIONAL OWNERSHIP
Number of institutional shareholders (#Institution) can help you get a handle on whether or not the company is flying below the radar of the big guys. So, too, can Inst%Own when evaluated in comparison with its industry average.
- INSIDER TRADING
Sometimes I work with insider buying, preferring number of transactions (InsBuyTrans) to number of shares (Ins#ShrPurch); the former shows sentiment while the latter mixes sentiment with personal wealth, i.e. buying power, of the insiders involved. Insider selling factors are here too, although they don't always signal sentiment since insiders do sell to monetize stock-based compensation.
- SHORT INTEREST
Depending on your temperament and philosophy, you can use these factors to go with the flow, or look for a potential short squeeze. I like measuring shorts by looking at SI%Float (short interest as a percent of float), SI%FloatPM (the same item for the prior month), SI%FloatPM2 (the items two months earlier) and SI%FloatPM3.
Using the factors to create a rule
When creating a screening rule, think in terms of three components:
- The Factor
This is the item you are using; EPS%ChgTTM, PEG, CurRatioQ, and so forth.
- The Relationship
A relationship is usually one of these
> (greater than)
>= (greater than or equal to)
< (less than)
<= (less than or equal to)
= (equal to)
!= (not equal to; note that this is different form the <> symbol often used elsewhere)
Portfolio123 is a powerful platform so this is not a complete list of possible relationships. But working with these can keep you busy for a long time, until you're prepared to tackle the advanced features.
- The Base
This is what the factor is being compared to. In the rule "PEG <= 1.00" The base is 1.00. In EPS%ChgTTM >= 20, the base is 20. We want the TTM EPS growth rate to be greater or equal to 20.
Up till now, we've always thought of the base as being a number. But in Portfolio123, that need not be the case. In fact, when I screen, the base is usually another factor. For example:
- EPS%ChgTTM >= Sales%ChgTTM
The company's TTM EPS growth rate is greater than or equal to the company's TTM Sales growth rate
- EPS%ChgTTM >= EPS%ChgTTMInd
The company's TTM EPS growth rate is greater than the average TTM EPS Growth rate of the industry to which the company has been assigned
- EPS%ChgTTM >= EPS5YCGr%
The company's TTM EPS growth rate is greater than its own 5-year growth rate
- CurFYEPSMean> CurFYEst4WkAgo
The mean (consensus) Wall Street EPS estimate for the current fiscal year is greater than where it stood four weeks ago
If you just stick with the kinds of rules demonstrated above, where the base is another factor, rather than a number, you'll already be building screens far more powerful than you can create on most other applications. But on Portfolio123, you can do more . . . much more. Here are some examples:
- EPS%ChgTTM >= (Sales%ChgTTM * 1.25)
The company's TTM EPS growth rate is at least 25 percent greater than the company's TTM Sales growth rate
- (EPS%ChgTTM / EPS%ChgTTMInd) > (EPS5YCGr% / EPS5YCGr%Ind)
The extent of the company's EPS growth superiority relative to its industry peers is greater in the TTM period than it was in the 5-year span. This introduces the notion that you can have multiple items (formulas) in both the factor area and in the base. Suppose the company is below the industry average. You could leave that rule as is and accept companies that are becoming less bad. Or you can do this . . .
- EPS%ChgTTM > EPS%ChgTTMInd And EPS5YCGr% > EPS5YCGr%Ind And (EPS%ChgTTM / EPS%ChgTTMInd) > (EPS5YCGr% / EPS5YCGr%Ind)
Yes, we can use "And" in your rules. So now, we repeat the above rule but apply it only to companies that are superior to their industry peers.
- EPS%ChgTTM >= EPS%ChgTTMInd Or Sales%ChgTTM >= (Sales%ChgTTMInd * 1.50)
Knowing from the above that you can use "And," it should come as no surprise that you can also use "Or." This rule is for one who likes to see above-average EPS growth, but would accept above-average sales growth in its stead. This rule accomplishes that subject to a requirement that the degree of superiority be great enough. Note, though, that with a rule like this, I'd worry that the sales surge was coming from a potentially dilutive acquisition. So I might do this instead . . .
- EPS%ChgTTM >= EPS%ChgTTMInd Or ((Sales%ChgTTM >= (Sales%ChgTTMInd * 1.50)) And EPS%ChgTTM >= 0)
This is the same as above, but we also require that TTM EPS not be down.
The negative number adjustment
Now, did you catch the bug in EPS%ChgTTM >= (Sales%ChgTTM * 1.25)?
Let's see . . . if sales growth is 4 percent, EPS growth would need to be at least 5 percent. That works.
If sales growth was minus 6 percent, EPS growth would need to be at least minus 7.5 percent. Ouch . . . that's not what we want. We might have an EPS growth rate that is worse than the sales growth rate!
Any time we make a comparison like that, where the base could conceivably be a negative growth number, we should consider adding a little safety valve into our rule.
EPS%ChgTTM >= (Sales%ChgTTM * 1.25) And EPS%ChgTTM >= (Sales%ChgTTM * .75)
Suppose the sales growth rate is 4 percent. We'd need the EPS growth rate to be at least 5 percent (4 * 1.25) and at least 3 percent (4 * .75). The latter is redundant. If growth is above 4 * 1.25, it's certainly going to also be above 4 * .75. And if it's below 4 * 1.25, the stock is omitted even if the 4 * .75 part of the rule is satisfied. In this case, the redundancy doesn't hurt us; it's simply irrelevant.
Suppose the sales growth rate is minus 6 percent. Minus 6 times 1.25 is minus 7.5, so we are exposed here to the sort of comparison we don't want. But the company would also have to pass the minus 6 times .75 requirement, which means its EPS growth rate could be no worse than minus 4.5 percent. That's OK. If EPS growth is minus 4.5 percent or better, compared to an industry average of minus 6 percent, we'll take it.
The first two parts of this How-To series showed you how to construct screens. Part 1 covered the Wizard. Part 2 covered Free Form. WThe first two parts of this How-To series showed you how to construct screens. Part 1 covered the Wizard. Part 2 covered Free Form. We’ll now help you put this knowledge to work by demonstrating some of the many kinds of screens you can build. This Part will focus on technical analysis and the next one will emphasize fundamental strategies.e’ll now help you put this knowledge to work by demonstrating some of the many kinds of screens you can build. This Part will focus on technical analysis and the next one will emphasize fundamental strategies.
Some technical analysis screens can be built using the Wizard, but most who emphasize this approach will choose to use Free Form, which allows for much greater flexibility and which covers ETFs in addition to stocks. The part of Free From you’ll use will be the category called FUCTIONS. Make sure you understand generally how to work with these, especially how to specify parameters. If you need to review, see Part 2, pages 12-23.
When building any screen, it’s a good idea to start with one or more liquidity filters. There’s no point in creating a model that looks great when backtested if it turns out that you can’t trade the stocks under real-world conditions.
Establishing Liquidity Thresholds
Here are some sample liquidity filters which you can copy to your clipboard and paste into the free form rule area.
Liquidity Based On Exchange Trading
- This eliminates pink-sheet stocks, those that don’t trade in the NASDQ or on an exchange.
- In the alternative, you could simply choose No OTC Exchange in the Universe-selection dropdown menu
Liquidity Based On Price-Volume
Close(0)>=5 and AvgVol(60)>=50000
- The first part of the rule looks for shares whose most recent closing prices were 5 or higher.
- The second part of the rule seeks stocks for which daily volume over the past 60 trading days averaged at least 50,000 shares
- It’s tempting to omit the price filter and use a much larger volume rule, but be careful about this. For stocks priced, say at $0.02, even 1 million shares worth of volume may not provide nearly as much liquidity as you expect: $0.2 per share times 1 million shares amounts to only $20,000 worth of stock. If you want to think along these lines, consider the next strategy.
Liquidity Based On Average Daily Total
- This rule requires the average daily total traded (price per share times number of shares) to have averaged at least $150,000 over the last 60 days
Liquidity Based On Market Capitalization
- Market capitalization must be at least $500 million
- For many, something like this will suffice on its own, the idea being that any issue with a market capitalization above a certain level is likely to have satisfactory liquidity. But if you’re worried about issues with less liquidity than meets the eye based on a large number of shares being owned by insiders and, for all practical purposes, not available for day to day trading, you could try something along the lines of our final sample strategy . . .
Liquidity Based On Float Capitalization
Float * close(0) >=400
- This requires the float adjusted market capitalization to be at least $400 million
- Float refers the number of shares in the hands of the public and can be found under STOCK FACTOR >> SHARE RELATED ITEMS. Multiplying it by price, expressed here as the last available closing quote. This gives us a figure that is analogous to market cap, but based more specifically on the number of shares that are available for day-to-day trading.
Going on, each of the technical screens illustrated below will presume that the first rule was used to establish a liquidity threshold based on one of the above sample, or something you created along similar lines.
Technical stock selection
In all cases, it will be assume that your first rule was used to address liquidity and that we are now working with rule two, and however many more rules, if any, will be needed. The way the functions are established in Portfolio123, it won’t take much to establish a strong technical model. One or perhaps two such functions (in addition to the liquidity rule) will often suffice.
Here, now, are some sample technical strategies. We’ll start with some that involve moving average. These have long been popular. They are effective in detecting trends as well as trend acceleration or deceleration. Also, they are very easy to implement.
Moving Average - Basic
- The stock’s 50-day simple moving average is above it’s 200-day moving average
- This is a very basic trending strategy
- More aggressive traders will probably want to use shorter moving-average time periods, such as sma(5)>sma(10)
Moving Average With Offset
- The first rule requires the 20-day simple moving average to be above the 20-day moving average as it was computed 20 trading days ago (i.e. using a 20-day offset)
- The second rule requires the 20-day simple moving as it was computed 20 trading days ago to be above the average as it was computed 40 trading days ago
- We’re looking, here, for acceleration in the moving average
Relative Moving Average
sma(50)/sma(200) > sma(50,0,#Bench)/sma(200,0,#Bench)
- Here, we’re not so much interested in the 50-day average being above the 200-day average, but instead, in the relationship between the two. The greater the gap between 50 and the 200 day averages (measured in percent terms, so we won’t get caught assuming $55 versus $50 (a 10% gap) is superior to $12 versus $10 (a gap that’s smaller in dollar terms but amounts to a larger percentage difference).
- The rule seeks situations where the relationship between the 50- and 200-day averages is superior for the stock than to the comparable averages somputed for a benchmark index (the default selection being the S&P 500).
- In a bear market, stocks could pass if the 50-day moving average was below the 200-day average, so long as the shortfall is less, in percentage terms, than is the case for the market
Now, let’s step it up just a bit. MACD is a fancier technical indicator that sounds a lot more intimidating than it is. In fact, it’s just a shorthand way of addressing more detailed moving-average strategies.
MACD - Moving Average Convergence-Divergence
MACD(0) > 0
- MACD is based on the relationship between the 12 and 26 day exponentially weighted moving averages. Unlike the simple moving average, which counts all prices in the averaging period equally, the exponentially weighted moving average gives more emphasis to recent prices.
- This rule requires the 12-day exponentially weighted moving average to be above the 26-week moving average. It could just as easily have been written as ema(12)>ema(26).
- To look for stocks whose MACD is accelerating, build a rule around the offset parameter, such as MACD(0)>MACD(5), which means the current MACD is greater than the MACD as of five days ago.
- The more interesting application of MACD may be in the indicator built around it, which we’ll examine next.
The MACD Indicator – MACDD
- The first two parameters tell us we’re looking at the basic MACD, the 12-week exponentially weighted moving average and the 26-week exponentially weighted moving average. Note, though, that in this version of the function, you can make changes. Perhaps you want to compare 5- and 15-week average. In that case, the first two parameters would be 5 and 15, instead of 12 and 26.
- Getting the third parameter starts with the differences between the 12- and 26-day moving averages. Assume the daily differences were plotted on a separate trend line. The 9-day moving average of that trend line, the difference line, is the third parameter. (You could, of course, change the 9 if you’d like to evaluate the difference over a longer or shorter period).
- When the MACDD is positive, it means the stock is in an uptrend and would be considered bullish by those who use such strategies.
Indicators like moving average and MACD are great because they can be expressed numerically, meaning they lend themselves well to applications like Portfolio123. Interestingly, though, it can be argued that indicators like these are contrary to tradition.
At its heart, technical analysis is a visual discipline, where one looks at a chart and evaluates patterns; resistance, support, cup-and-handle, head-and-shoulders, pennant, and so forth. The problem is that such things can’t be expressed numerically, since often the presence or absence of a particular pattern tends to be in the eye of the beholder.
But there are some chart patterns that can be translated to numbers.
GapUp(10,500,20,0) = true
- This rule looks for stocks that experience a gap up (a daily low that was higher than the previous day’s high price) of at least 10%. This even must have happened some time within the past twenty trading days and must have been accompanied by a volume spike of at least 500% above the average volume that prevailed during the 20-day period.
GapDown(10,500,20,0) = true
- This is the mirror image of the GapUp. Here, we’re looking for cases when the day’s high was at least 10% lower than the prior day’s low.
- Don’t fall into the temptation to assume that such a rule is only for short sellers. Here’s an example of a screen that looks for stocks whose trends were OK, at least up till 60 days ago, but experienced a gap down between 20 and 40 days ago, but has recently started to show signs of resuming its old uptrend.
GapDown(10,500,20,20) = true
- The first two rules make use of the functions’ offset parameters. If you are at all unclear about this, review the discussion of Functions in Part 2.
- Copy this screen and backtest it. You’ll see that this is not the sort of model you can use if you just want to buy all the stocks that pass. But if you look closely at the individual holding periods, you’ll see that there are usually few enough passing stocks that you do have time to review them all case by case, and that plenty of good opportunities can be uncovered this way.
Highest(#Close,20,0) > Highest(#Close,20,20)
- This rule evaluates closing prices (you could also use open, intra-day high, intra-day close, or volume) and looks for situations where the highest close within the past 20 trading days was above the highest close achieved during the prior 20-day period.
- You can really push this function, and use it alongside the mirror-image Lowest function, to screen for a pattern of higher highs and higher lows.
Highest(#Close,20,0) > Highest(#Close,20,20) * 1.05
Highest(#Close,20,20) > Highest(#Close,20,40) * 1.05
Lowest(#Close,20,0) > Lowest (#Close,20,20) * 1.10
Lowest(#Close,20,20) > Lowest (#Close,20,40) * 1.10
- If you like visual chart analysis, look at this and see if it rings a bell.
Highest(#Close,20,0) < Highest(#Close,20,20)
Highest(#Close,20,20) < Highest(#Close,20,40)
Lowest (#Close,20,0) > Lowest(#Close,20,20)
Lowest (#Close,20,20) > Lowest(#Close,20,40)
- I wouldn’t go so far as to say the latter is the pennant formation, but it has key elements in common; descending highs and ascending lows heading toward a point at which, presumably, something noteworthy is bound to happen. But be careful about using this for a buy-all-the-names screen. The “something” at the end of a pennant might be negative. Use this screen to hunt for ideas you’ll evaluate case by case, or combine it with other factors that give you reason to think the next move is more likely to be positive.
- NOTE: Copy the pseudo-pennant screen. Backtest it using one-week holding periods. Backtest again using four-week holding periods. Assume zero slippage Notice the superiority of the four-week test. This is an example of how ideas often need time to materialize, even when selected on the basis of technical analysis. Now try testing with a one-day holding period. Here, a zero-slippage assumption would be way too tenuous. Assume 0.25%. This test is terrible. Now, just for laughs, assume zero slippage. This time, the result looks a lot better. Moral of the story: day trading can be great on paper, but unless you’re a superstar at navigating your way around bid and ask spreads, you may be better off giving your ideas time to develop, and to overcome the initial spreads you faced when you bought.
When we think of visual chart analysis, it’s usually assumed that that we’re looking at stock prices. But that doesn’t always have to be the case. The Portfolio123 CrossOver function, for example, looks to moving average plots for an important visual cue, and one that can be expressed numerically.
- Technicians often talk about the desirability of the 50-day moving average being above the 200-day moving average. If we’re going to assume that trends persist, as we would if we use trend-oriented strategies such as moving average, it seems reasonable to also assume it would be better to get in during the early stages of a trend. CrossOver helps us do that.
- The above rule looks for stocks whose 50-day simple moving average (the first parameter, #sma) crossed above the 200-day average at some point within the last ten trading days.
- For contrarians, or those who believe in mean reversion (oscillation), there is a mirror-image CrossUnder function.
On several occasions, it was noted that mirror image functions exist to identify what, at first glance, would seem to be bearish technicals: GapDown, Lowest, CrossUnder. The extent to which these are necessarily bearish, however, is a matter for debate.
Just as fundamental investing has different stylistic camps (e.g., growth versus value), so, too, does technical analysis: trending versus oscillating. Except for the side notes on mirror-image functions, we’ve focused thus far on trends. We looked for stocks whose trends seemed favorable and attempted to write rules that would help us identify them in the screener.
Oscillation reflects a different perspective, sometimes referred to as mean reversion. It assumes there is some sort of central tendency and that stocks often bounce around on either side of their theoretically proper levels. When they get high, it is assumed they will correct back down toward the proper level. When they get too low, it is assumed they will bounce back. This doesn’t mean the true and correct trend is always sideways and that every instance to the contrary is an aberration that needs to be corrected. Actually, history gives considerable ammunition to those who argue that the central trend tilts upward, with much of the debate on being on how steep or gradual the slope is. But even in the context of a long- or intermediate-term uptrend, stocks do bounce around above and below the central tendency necessitating frequent reversions to the mean.
Technical analysis offers some indicators, known as oscillators, that help investors judge whether and the extent to which a stock may be overbought or oversold and, presumably, poised for decline or rally. These indicators differ from others in that lower numbers usually signify bullishness (low number are associated with oversold conditions).
Oscillators can involve complex calculations (actually, for mathematicians, they are extremely simple, but for investors, they are considerably more involved than P/E, growth rates, or even MACDD). Here’s how the Ultimate Oscillator, one of those offered in Portfolio123, is calculated. This is presented just for the information of those who’d like to know. If you like, you certainly can skip the computations.
Buying Pressure: bp = close – (lesser of intraday low or prior day close)
True Range: tr = (greater of intraday high or prior day close) - (lesser of intraday low or prior day close)
7-day Average = (bp-1/tr-1 + bp-2/tr-2 . . . bp-7/tr-7) / 7
14-day Average = (bp-1/tr-1 + bp-2/tr-2 . . . bp-14/tr-14) / 14
28-day Average = (bp-1/tr-1 + bp-2/tr-2 . . . bp-28/tr-28) / 28
Ultimate Oscillator = (((4 * 7-day Average) + (2 * 14-day Average) + (28-day Average))/7) * 100
Again, if you can’t follow it, or prefer not to bother, don’t worry. Suffice it to say that high levels of the oscillator, signifying greater buying pressure relative to the stock’s “true” range,” suggest it’s overbought and vice versa.
Interestingly, although this is complex to calculate, it’s easy to implement in Portfolio123.
- This rule seeks stocks for which the current level of the ultimate oscillator is 30 or below.
- If you want to look for stocks for which the ultimate oscillator has been becoming increasingly oversold, try this:
- Here’s another approach:
This is a representative sample of the kinds of things you can do with the technical indicators on Portfolio123. For those who are more advanced in this area, we offer a set of Wilder-based indicators. The calculations are too complex to be covered here, but for those who know what they are and want to use them, the functions as presented on Portfolio123 are just as easy to work with as the ones discussed above. Check the Descriptions that accompany the functions. If you’d like to learn more about the J. Welles Wilder indicators, you can check his book New Concepts in Technical Trading Systems.
Technical-Fundamental Analysis screens
Many who use technical analysis stick to just that and do quite well.
Many others use technical analysis hand-in-hand with fundamental analysis. The most typical approach is to identify a list of suitable investment candidates using fundamental criteria. These tell us which stocks deserve to move. But such factors don’t necessarily tell us when the stocks will actually receive the favorable treatment they ought to have. Remember the old adage:
Q: How long can the market continue to be wrong?
A: A heck of a lot longer than you can continue to stay solvent!
Based on this, many investors filter fundamentally sound stock lists through technical filters to help them determine, not if the stock is worth buying, but whether it would be reasonable to act on bullish sentiment right now.
Doing this is easy. Just create a fundamental screen and then, add one or two technical rules such as those discussed above to the screen.
The challenge lies in strategy. What sort of technical rules might enhance the performance of a fundamental screen?
Consider, for example, use of the pre-defined Quality – Basic screen as a starting point:
universe(nootc) and close(0)>=5 and mktcap>=250 and Industry!=fsmisc
This simple set of rules will usually uncover about 150 stocks that most would regard as fundamentally sound, the sort of stocks the average investor should feel comfortable owning. Assume, too, we boost the comfort factor by honing in on the top 15 stocks as per the Portfolio123 QVG (Quality-Value-Growth) ranking system.
To many, it will seem eminently sensible that a technical rule, if added, should be geared toward identifying which of these sound stocks are actually trending favorably. Try it. Add the following rule: sma(50)>sma(200). Now, backtest the top 15 as per the QVG ranking system.
As of this writing, that test produced very disappointing results. The model outperformed the market when no technical filter was used, but substantially underperformed when the sma rule was added.
Now change the technical rule to this: sma(5)>sma(20). This is a much shorter-term version of the same thing, Backtest again.
As of this writing, the model is now outpacing the market, but by a lesser amount than was the case before the rule was added. From the vantage point of trying to support a buy-now decision, the second rule, with its short term orientation, added new information to our model, which tended to focus on less immediate factors. That was a plus. But it’s still not doing for us all we need, since we’d still be better off with no technical filter at all.
Now, flip the technical rule around. Make it look like this: sma(5)<sma(20).
This definitely is new information, very new information. We’ll now get a list of consistently fundamentally solid companies whose stocks lost steam.
Interestingly, in this test, the model outperformed not just the market, but also the results achieved by using fundamentals alone.
The moral of the story: Learn to love, or at least respect, the notion of mean reversion (or oscillation) if you haven’t yet done so. The market never goes up or down in an infinite straight line. If you pile up too many bullish rules in your model, you may simply be increasing your exposure to the prospect of a downward correction.
This isn’t to say you should never add a bull-oriented trending technical rule to a fundamental screen. There are times when that will help. But such occasions should be identified via testing, not seat-of-the-pants hunches, and not even based on your experience with purely technical screens.
When you’re doing technical analysis alone, your bullish technical rules will often help steer you toward stocks that have been deemed fundamentally sound in the eyes of market participants whose collective trading decisions resulted in the bullish patterns you detect. When you add technical rules to a fundamental screen, you don’t need to think this way. Your fundamental rules will have done all the necessary legwork in pointing you toward good companies. The addition of a bullish technical rule may amount to overkill.
Technical-Analysis Used To Identify The “Best”
This is similar to the technical-fundamental combination screen except here, the screen contains technical rules only. All fundamental concepts are incorporated into one of the pre-defined Portfolio123 ranking systems, or a quick-sort that you create.
This approach is useful when you want to create a broad technical screen, one that is likely to show more passing situations than you are able to buy or analyze. Use the quick rank or ranking system to narrow the list to a manageable number.
Consider, for example, the Gap Up pattern. What’s not to love – a stock that jumps briskly on big volume. This doesn’t happen often, but it can be frequent enough to produce more stocks than anyone can buy or analyze.
Create the following simple two-rule screen:
GapUp(10,500,20,0) = true
Backtest results are good (assume weekly rebalancing), but often, the screen contains more than 50 stocks, sometimes, more than 100. There’s not much we can do in the real world with something like this.
Now, change the settings so that we consider only the top five stocks and that these be selected using the Basic: Sentiment ranking system, Backtest again.
The picture changes quite a bit. Performance is again strong. This time, though, you can do something about it; you can follow an automatic trade-everything-weekly strategy, or you can look at each chart individually and decide case by case.
Mix and match technical screens and ranking systems and test the combinations. Not everything will work. But you’ll see many that will be backtest quite nicely with 15, 10 or even 5 stocks.
Now, try a variation using Quick Rank.
Setting up a Quick Rank is similar to creating a free-form fundamental screening rule. Clicking on the note-pad icon next to the Quick-Rank box will open the free form rules interface; you can use this and or type manually. The one difference is that the Quick Rank item needs to always be in true-false form. Don’t actually say =true; just input the factor. For example, if you want to sort based on the trailing 12 month rate of EPS growth, all you need do is input: EPS%ChgTTM.
Try combining the EPS%ChgTTM Quick Rank with the Gap Up screen and backtest. The result is OK. But here, too, you can mix and match. Try combining the Gap Up screen with analyst upgrade, improvement in the average analyst recommendation score. This is: AvgRec- AvgRec4WkAgo. Make sure you set the drop-down menu to say Lower is Better (these scores sun from 1.00, best, to 5.00, worst). Assuming you’re looking for the five best stocks and are rebalancing weekly, this should be considerably stronger.
The screen-quick rank paring can also go the other way. You can have a fundamental screen and narrow down with a technical Quick Rank. Here, though, you’d need to use a formulation that lends itself to a numeric answer, something that can be sorted. So it would not be helpful to specify GapUp(10,500,20,0) as a Quick Rank formula. Formulas you could use include sma(50)/sma(200) (higher is better), sma(5)/sma(20) (lower is better), MACDD(12,26,9) (higher is better and so forth.
The Simple Moving Average Function
Here’s a sample technical-analysis rule: Consider stocks only if the 50-day simple moving average is above the 200-day simple moving average.
This function syntax is SMA(bars [,offset,series]).
Based on what we already learned, we know that “bars” is a placeholder for a number. More specifically . . .
- Bars is number of trading days over which the moving average should be computed. It has to be a number between 2 and 500.
The brackets tell us the next two parameters are optional.
- Offset is an days-ago number. An offset of 10 means we’d calculate what the 50-day moving average was as of 10-days ago. Offset can be between zero and 100.
If we leave this blank, the function will assume it should be zero. In other words, there would be no offset and we’d compute the current moving average.
- Series answers the question: Compute a moving average of what?
If we leave the Series parameter blank, the function will assume we want to calculate the moving average of closing prices. This information is contained in the Full Description, where we also see a list of alternative series we could use. If we’re interested in market timing, we might use #Bench, which refers to the market benchmark that has been selected in the screener settings (the default is the S&P 500).
Using this information, here are some possible ways we could use SMA (or sma . . . it’s not case sensitive).
- SMA(50) > SMA(200)
The 50-day moving average is above the 200-day moving average.
- SMA(50) > SMA(50,20)
The latest 50-day moving average is above the level at which the 50-day moving average stood 20 days ago.
The 50-day moving average of the market is above its 200-day moving average. If this condition is violated, no stocks will pass the screen, meaning we’d in essence, be going all cash; hence the market timing element.
Notice, in the last example, how use of the third parameter, the series, forced us to also use the second parameter even though it was originally optional.
For a second parameter, the SMA logic expects to see nothing at all, or a number. So if we use SMA(50,#Bench), we’d get an error message because the logic would not be able to cope with seeing #Bench where it expects a number. So even if we don’t want an offset, we must plug in a zero in order to push #Bench to the place where it belongs, the third position.
IMPORTANT: It is critical that each parameter be placed in the correct position, even if it means using zero for some optional parameters that we’d like to skip.
Pause here and review SMA. Let it sink in. Although it’s not the most elaborate technical-analysis concept, the function is pretty intricate given its use of optional parameters one of which involves specification of a series. One you feel fully comfortable with SMA, you should find most other functions quite easy.
When you feel ready to go on, we’ll tackle GapUp, which is interesting in that unlike SMA, we’re not asking the logic to give us numeric output. Instead, we’re looking for a yes or no; either the pattern we specify happened or it didn’t happen.
The Gap Up Function
This is where investors look for stocks that experienced a significant upward gap between the closing price on day one and the open price on day two. On Portfolio123, those seeking to implement this strategy can use the GapUp function. (There is a also a GapDown function for those who are interested in the opposite approach.)
As with other functions, you do not need to program the details of an upward gap. All the necessary logic is stored inside the function and will execute when Portfolio123 finds it in a rule. You only need to supply the parameters, the important numbers that vary from investor to investor based on individual preference and even with the same investor at different points in time.
Let’s assume you want to look for a stock that experienced a gap up within the last five trading days.
- By thinking in terms of five trading days, we have already established one parameter
- Another parameter is the size of the gap. Will a 1% jump interest us? Most who use a strategy like this won’t care about a move that small. Let’s say we are interested in up gaps of at least 10%. That is another parameter.
This alone is enough to implement the strategy. Here’s the function description:
Notice that the function requires four parameters. We have akready identified the numbers we’ll use for two of them: we decided bars will be set at 5, and that GapPct will be 10. We’re not using the other parameters. We don’t care about volume and we want the function to execute as of now, so we aren’t using an offset.
So it might seem that we should articulate the function as follows:
That will not work.
Look again at the function description. None of the parameters are identified as being optional, as would be the case if the description looked like this: GapUp(GapPct,bars[,VolPct,offset]). But that’s not what we see. Nothing is enclosed in brackets. That means everything is mandatory. If we don’t want to assign values, we have to plug in zeros. So let’s fix it.
Again, this is not correct.
It’s not enough to have the correct number of parameters. Each one must be in the proper position.
The function we wrote starts reasonably; Portfolio123 will look for stocks that experienced gaps of at least 10%. It will refine the search by limiting consideration to those whose volume on the day of the gap was at least 5% above the average experienced over the number of days we set with the bars parameter. So, far so good . . . sort of. It is possible that we want 10 and 5 in the GapPct and VolPct positions, so this won’t precipitate an error. But it’s not what we chose (5 is meant to bars, not VolPct) so the result will be wrong. Next, the function will encounter a zero when it evaluates bars. That’s illogical. We need a number for bars.
All this is meant to drive home the importance of function descriptions, how these are vital references that should be used regularly. Again, no prizes are awarded for memorization or successful guessing.
Let’s now write the function correctly, with all required parameters in place, in their proper positions, and with zero if necessary to populate a parameter we’d rather not use.
That is correct. It will show us the stocks we want to see.
Many will not want zero in the second position, the VolPct parameter. They’d rather restrict consideration to gaps that were accompanied by noteworthy volume spikes. Let’s assume we decide to do that; we’ll insist that gap-up volume be at least 500% above the average of the last 5 trading days, 5 being the bars parameter (note that the bars parameter does double-duty; it tells us the number of days against which the volume spike should be compared and how many days back we can search for a gap) . If we choose to do this, our function would look like this:
So now that we have this function, what should we do with it. How can we get Portfolio123 to use it.
As noted, this is not like SMA, which calculates a number. This function looks for a yes or no answer. Either a stock experienced a gap up under the conditions we articulated, or it didn’t; yes or no. In computer-talk, that translates to true or false. Accordingly, we can create a rule that looks like this:
GapUp(10,500,5,0) = true
It would also be ok to leave the function in the rule by itself. All factors or functions that are sitting alone will be evaluated by Portfolio123 as if the “= true” were also there. So the following alternative rules would produce identical results:
GapUp(10,500,5,0) = true
(NOTE: By the way, the implied “=ture” feature exists for every Portfolio123 factor or function. Start a new screen and for the first rule, just type the word price. Click on Totals to see how many stocks pass the screen. You’ll notice that every stock in the database qualifies. By typing price alone you implied price=true, which meant you searched for every stock that has a stock price. Since all stocks in the database have prices, all pass.)