13
Archived articleThis is an archived article from 2018 - please note that any content within the article may be out of date.

Building a general purpose performance-based screen

THE IDEA

Suppose we want to build a screener using a set of rules to create a portfolio which meets some criteria. (For example: good performance over the next year.)

These rules look like:

metric > value

or

metric < value. 

So they divide the stocks into two sets: the stocks we keep and the stocks we reject - hopefully in a way which meets our defined goals.

In statistics this is called a classification problem and the value is called the 'cutoff'. Are there any guiding principles we can use to choose these cutoff values?

A portfolio usually turns out to contain about 10% super performers, 10% disasters and 80% not doing very much in the middle. So if you can change the ratio of super:disaster, and in particular avoid disasters, you can tip the portfolio into better performance. The mush of middling performance in the middle will have quite a low effect on the overall portfolio performance so we don't worry too much which of these stocks get included or rejected by the rules.

It turns out that this mush in the middle is quite handy. If we try to maximise the ratio super:disaster for each rule individually we introduce a lot of data mining errors, because the best ratio is likely to result when 'super' and 'disaster' are both quite small numbers - which encourages very high cutoffs. And the exact value of the cutoff is very sensitive to exactly what happened in the period we are using to test out theory. This is a classic example of over-fitting to historical data, and will almost always give poor results.

So instead of doing that, let's try to maximise the value (super - disaster) for each metric instead. This way we pass as many stocks through each rule as possible, subject to trying to keep a big excess of super stocks versus disaster stocks.

As a consequence, we will need more rules to reduce down the number of stocks that pass to a sensible portfolio size, because each rule prunes away relatively fewer extra stocks.

Originally I calculated cutoffs for the metrics that I've kept data for. For example, here is a plot of an analysis for the "ROE %" metric.

5b578985d66b4vcroe.png

The minimum of the function (shown by the dotted blue line) locates the "ideal" value for the cutoff. As you can see this minimum is very close to the pink line marking the median value. (There is also a similar dip at exactly zero. An ROE% > 0 is also a very good choice for the cutoff in this case.)

In fact, for many metrics the best value for the cutoff is very close to the median value, and even when it is not near the median, often there is enough flabbiness in the data that the median would not be a poor choice. This is partial confirmation of the idea that we do not need to worry too much about which of the middling stocks get through the screen. This is where the "mush" works in our favour.

Even more intriguing, it does not matter whether you define good performance in terms of best return over a year or lowest probability of a poor return over a year - the results are very similar. So this turns out to be a very robust way to create rules for a screen. ("Robust" in the sense that it isn't a result of data mining or tuning and it tolerates small perturbations to the data, or the way the problem is phrased.)

As a bonus it tunes itself automatically if the values tend to drift over time. It is even possible to use sector medians instead of market medians so that the cutoff is more appropriate for each stock's business.

However, it only works for certain kinds of metric. Notably, it works for metrics which Stockopedia's help glossary defines as:

  • Profitability
  • Price History (price changes over a period, SMAs, and Highs and Lows)
  • Growth
  • Analyst Forecasts of growth parameters


But it does not work for these categories:

  • Valuation
  • Dividends
  • Financial Strength (in general, although it does work with some)

You can combine as many of these rules as you like, whether they are correlated or not, to build a screen.

A TEMPLATE AND HOW TO PLAY WITH IT

So, here is a template screen which embodies a large number of "performance" metrics which implement this simple system. In its initial raw form it will let through very few - or even zero - stocks. That is because I have deliberately included as many metrics as I could. You will have to do some work to get a usable screen!

To use the screen you need to tune it to suit your personal style or preferences. But it has a robust nature; it does not matter too much whether the individual metrics you keep are strongly correlated (for example - all the momentum metrics) or have low correlation (e.g. taking one rule from each category in the Stockpedia glossary). As a result it is quite an easy set to play with. Just turn rules off until you get a screen which works for you.

The order of the rules is approximately in order of selectivity. That is to say, on my rough data, the earlier rules are more important when choosing good stocks than later rules. So when run as a checklist, failing earlier rules is possibly more significant than failing later rules. However take this with a pinch of salt. I find it helpful - but a stock always has to pass all the rules which are turned on - so it is only a suggested guide.

As a side note, some of the "performance" metrics in this template are quite surprising. I include them because they work in this context - namely that we need a lot of rules, each of which crops our list according to a similar but slightly different point of view.

(I have also included a small number of other rules for common financial strength, size and spread checks, plus an example valuation check and a Sharpe Ratio check. All of these other rules are turned off in the template to preserve its "purity" but feel free to turn them on or substitute your own additional rules.)

Some suggestions about ways to customise the screen:

use as a checklist

Just use as a checklist on a stock you are interested in and get a quick summary of how many rules pass and which  rules pass (which gives some hints as to the strengths and weaknesses of the stock.)

fundamental rules only

Turn off all the price momentum based rules and use only fundamental performance data. Although this many not correspond with current price action it will select stocks with a strong underlying fundamental performance.

momentum rules only

Turn off the fundamental rules and just focus on the price history. There is often a split between long period and short period momentum. My data suggests that even a 5 day price change greater than the median is mildly correlated with the one-year performance of the stock. However in general the main way to use short period momentum is as a timing mechanism, not for screening. For example you could set an alert based on 5 day or 1 month price change or 1 month RS after selecting a stock using longer period momentum or fundamental factors.

consider turning off N/A-prone rules

Even a good stock will get rejected if just one of the rules has an N/A result. This can be quite frustrating. Some metrics seem to be more prone to this problem than others. For example the metrics called "% 1m EPS Upgrade FY2" and "% 3m EPS Upgrade FY1" have a bad habit of being N/A for otherwise promising candidates. So you might decide to turn off rules which generate too many N/A results.

Stocks which do not pay a dividend will similarly return N/A for any metric which involves dividends. Turning off dividend-based rules is another avenue to widen the search.

use one or two exemplar stocks to decide which rules to keep

This is a slightly unscientific approach which can work quite well! Choose one or stocks which are well thought of and pass a reasonable number of the rules in the template (use the 'checklist' feature), and then turn off the rules which they fail. You might need to do this for two or more stocks but then you should find that you get a reasonable collection of similar good quality stocks.

what about rank in industry group?

All the rules in the template use "rank in sector". It is possible to change this to "rank in market" or "rank in industry group". However there are some problems with using the industry group. Some industry groups are just too small for relative performance between all the constituents to give a meaningful median. As a result stocks in those industry groups will tend to get selected even if they are relatively quite poor.

is it better to remove rules completely, or just weaken the test e.g. rank(30) instead of rank(50)

My view is that it is better to turn a rule off completely rather than try to weaken it. The reason is that the median value acts to maximise the good-minus-bad value. If you weaken the rule you can't be sure that by rejecting some stocks and not others that you are not making the overall ratios worse rather than better.

It is important to stress that this approach is intended to be used when there are a lot of rules working together; maybe as many as twenty to thirty rules. It does not work as well when only used with a small number of rules. When using a very small number of rules then it might make sense to strengthen the test (e.g. use rank(80) instead of rank(50)). However this moves outside the scope of this article.

The stocks it chooses tend to be quite conservative; maybe not the most aggressive but generally good performers.

WHY DOES THE CUTOFF BEHAVE LIKE THIS FOR SO MANY METRICS?

Basically, all the metrics for which the method works are indirect ways to estimate μ (the underlying median growth of the stock and one of the parameters in the GBM model of stock price evolution.) This is very similar to our desired outcome (high growth over the next year).

The distribution of outcomes amongst the stocks is roughly symmetric and this is why the median value of one of these metrics is generally close to the optimum cutoff.

Because they are estimating the same parameter, in theory they should all rank in a similar way and hence reinforce each other's preferences.

The valuation metrics are not estimators of μ. A stock can be priced cheaply or expensively completely separately from whether it has high or low underlying growth.

IS THERE A SIMILAR PATTERN FOR VALUATION METRICS

Yes - but it is not so easy to make use of. If the outcome you are trying to predict is something that the Valuation metrics measure indirectly (such as low volatility (indicating fairly accurate pricing)) then there is a pattern. However it is not a median cutoff but a range either side of the median.

But note that accurate pricing on its own is not particularly useful. A stock can absolutely awful and very accurately priced!

As discussed recently on Stockpedia there is some evidence that high Value is useful in a bear market but less important in a bull market.

GOING SHORT

This method can also be used to created a short version of the screen. In fact all you need to do is to keep the rules but change each test from
metric > rank(50)
to
metric < rank(50)

But also bear in mind that N/A for a rule will eliminate the stock. So any rules based on dividends would eliminate any stocks which don't pay a dividend - which is probably not what is intended when looking for stocks to short.

(The keen-eyed will notice that this reverses each rule individually but it still ANDs together all the rules. It is not the logical complement of the long version of the screen. This works because the way the cutoff was defined means that the cutoff for choosing to go long is the same value as the cutoff for choosing to go short (but in the opposite direction.) This is part of why these cutoffs are so robust to use.)

There is another problem with using these rules as short screen. Although they are likely to identify stocks which will be lower in a year's time, most shorts are not intended to be held for that long and there can be a lot of volatility with poorer performing stocks in the meantime.

SUMMARY

  • You can combine any number of "performance" metrics into a screen, regardless of whether they are correlated or not, by using the median value as a "cutoff". The motto is "the more the merrier" but the rules must measure "performance", avoid too many N/As, and use the median as the cutoff.
  • This does not work for metrics which measure valuation.
  • You still need to decide for yourself which of the performance metrics you care about (and are adequately represented by Stockopedia without too many NA values.)
  • Here is a template to play with: https://www.stockopedia.com/sc...

Disclaimer

This is not financial advice. Our content is intended to be used and must be used for information and education purposes only. Please read our disclaimer and terms and conditions to understand our obligations.

16 comments


Avatar for andrewdb

... so are you taking these individual rules and then optimising a combination of them for selecting a set of ~N stocks that have the best performance over the last 12 months

... and then seeing what actually happens over the next 12 months

?

1
Avatar for Nick Ray

What the spreadsheet here does is to separate a year's performance into three parts: good (the top third), bad (the bottom third) and the third in the middle we ignore. (You could use the top and bottom decile instead (but that won't work well with only 300 data points though.) In practice it does not matter too much how you define the good and bad portions.)

So for each of good and bad we look at some metric at the beginning of the period (in this case ROCE) and see how likely it is that stocks with each value of that metric fall into the good or bad group. By using the whole distribution and comparing the shape of the good and the bad version we can see at what value of the metric we get the best separation of good and bad. That's all there is to it. If you don't use metrics which provide some measure of performance you will not get sensible results though.

As far as optimising a combination is concerned, one of the aims here was to try to choose cutoffs so that you can combine rules easily without having to explicitly optimise a combination together. So although I stress that you need a reasonable number of rules, they are each optimised independently.

There is a bit of a philosophy here that not everyone will buy into. But to me it seems there is a "club" of decent stocks that keep turning up no matter what screen you use. And a lot of them drop out of screens and then pop back in again six or twelve months later. So it is like a fuzzy set of stocks. This club is actually quite big - maybe 100 stocks or more. Once you've basically found the club, to some extent it does not matter too much which subset you choose to put in your portfolio. The NAPS system also basically picks from the same fuzzy set and deliberately tries to impose sector diversification on its choices. Using "rank in sector" instead of "rank in market" acts in a similar way here.

As for seeing what happens over the next 12 months - well in the sense that we are trying to screen for stocks with good performance going forwards, yes!

3
Avatar for DWit199

Thanks Nick. I will work through those formulae and see if I can understand it.

0
Avatar for Nick Ray

In case anyone is struggling to read the formulae or would like to cut-and-paste here is table version of them. Although it looks a bit ugly here, it should cut and paste as a table into a spreadsheet with a bit of luck!

data="Sheet1.$b$2:Sheet1.$b$28069"
minval=PERCENTILE(INDIRECT($C$1);0.025)
maxval=PERCENTILE(INDIRECT($C$1);0.975)
median=MEDIAN(INDIRECT($C$1))
goodstart=(2/3)*COUNT(INDIRECT($C$1))
goodend=COUNT(INDIRECT($C$1))+1
badstart=2
badend=(1/3)*COUNT(INDIRECT($C$1))
good=ADDRESS('goodstart';2;1;;"Sheet1") & ":" & ADDRESS('goodend';2;1;;"Sheet1")
bad=ADDRESS('badstart';2;1;;"Sheet1") & ":" & ADDRESS('badend';2;1;;"Sheet1")
stepmetricgoodecdfbadecdfdelta
0=$C$3+$A16*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B16)=PERCENTRANK(INDIRECT($C$13);$B16)=C16-D16
=A16+(1/20)=$C$3+$A17*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B17)=PERCENTRANK(INDIRECT($C$13);$B17)=C17-D17
=A17+(1/20)=$C$3+$A18*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B18)=PERCENTRANK(INDIRECT($C$13);$B18)=C18-D18
=A18+(1/20)=$C$3+$A19*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B19)=PERCENTRANK(INDIRECT($C$13);$B19)=C19-D19
=A19+(1/20)=$C$3+$A20*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B20)=PERCENTRANK(INDIRECT($C$13);$B20)=C20-D20
=A20+(1/20)=$C$3+$A21*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B21)=PERCENTRANK(INDIRECT($C$13);$B21)=C21-D21
=A21+(1/20)=$C$3+$A22*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B22)=PERCENTRANK(INDIRECT($C$13);$B22)=C22-D22
=A22+(1/20)=$C$3+$A23*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B23)=PERCENTRANK(INDIRECT($C$13);$B23)=C23-D23
=A23+(1/20)=$C$3+$A24*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B24)=PERCENTRANK(INDIRECT($C$13);$B24)=C24-D24
=A24+(1/20)=$C$3+$A25*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B25)=PERCENTRANK(INDIRECT($C$13);$B25)=C25-D25
=A25+(1/20)=$C$3+$A26*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B26)=PERCENTRANK(INDIRECT($C$13);$B26)=C26-D26
=A26+(1/20)=$C$3+$A27*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B27)=PERCENTRANK(INDIRECT($C$13);$B27)=C27-D27
=A27+(1/20)=$C$3+$A28*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B28)=PERCENTRANK(INDIRECT($C$13);$B28)=C28-D28
=A28+(1/20)=$C$3+$A29*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B29)=PERCENTRANK(INDIRECT($C$13);$B29)=C29-D29
=A29+(1/20)=$C$3+$A30*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B30)=PERCENTRANK(INDIRECT($C$13);$B30)=C30-D30
=A30+(1/20)=$C$3+$A31*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B31)=PERCENTRANK(INDIRECT($C$13);$B31)=C31-D31
=A31+(1/20)=$C$3+$A32*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B32)=PERCENTRANK(INDIRECT($C$13);$B32)=C32-D32
=A32+(1/20)=$C$3+$A33*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B33)=PERCENTRANK(INDIRECT($C$13);$B33)=C33-D33
=A33+(1/20)=$C$3+$A34*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B34)=PERCENTRANK(INDIRECT($C$13);$B34)=C34-D34
=A34+(1/20)=$C$3+$A35*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B35)=PERCENTRANK(INDIRECT($C$13);$B35)=C35-D35
=A35+(1/20)=$C$3+$A36*($C$4-$C$3)=PERCENTRANK(INDIRECT($C$12);$B36)=PERCENTRANK(INDIRECT($C$13);$B36)=C36-D36
1
Avatar for DWit199

Sorry Nick, I'm probably being a bit dim but I still don't fully understand the charts. Could you walk through an example for me? If I could recreate the chart I would have a better understanding of you message.
I have a spreadsheet with data on 300 shares, Names in column A, ROCE at the beginning of the year in column B, Total Return for the following 12 months in column C. How do I get to one of your charts from that data?

1
Avatar for Nick Ray

That is a bit of a tall order. I'll try to see whether you can approximate this in a spreadsheet but it's going to be heavy going. I think the nearest thing to an ECDF is the RANK function but it then gets very messy because I need to filter by various conditions and then align the two ECDFs that are created, and I'm not sure if spreadsheet functions are up to it.

0
Avatar for Nick Ray

OK. Here's a spreadsheet version. I've used OpenOffice so you might need to adjust to suit the syntax of your preferred spreadsheet. It is a bit hairy!


So here is a sheet with data in the format you described (Ticker, ROCE, yearly return):

5b59f2d0b579edatasheet.png

You can include the same stock more than once if you have multiple years of data.

You need to sort this sheet on column C as in the example above with lowest values first.

Now in a second sheet you want these formulae: (right click - view as image to enlarge)

5b59f39cee50fsheet2.png

The rows from 17 to 36 are all identical - you don't need to type them in individually.

Set up the value in C1 so that it points at your data in 'Sheet1'.

You should get a sheet which looks a bit like this:

5b59f456ad001sheet2results.png

And if you plot the "metric" column against the "delta" column you get a plot similar to the ones I presented, hopefully with a minimum near the median value:

5b59f4e26d897rocedelta.png


4
Avatar for DWit199

Nick, could you explain in a little more detail how you calculate the probability delta plots and what the axes mean?

2
Avatar for Nick Ray

Very briefly, it is the difference between two ECDF (empirical cumulative distribution function) plots, one for high-performing stocks and one for low-performing stocks. The nice thing about ECDFs is that they capture something about the whole distribution, whereas working with just the mean and variance alone will make some inaccurate simplifications.

The genesis of the idea was born in the discussion on this article which looked at the distribution of returns depending on the value of the Stock Rank. Eventually I became interested in the way that these distribution functions cross over when you might expect that the high stock rank curve would remain better than the low stock rank curve over the whole length. (see my comment #26 in the thread.)

Anyway, eventually I reversed the question and asked what was the distribution for a given metric on the x-axis when looking at the top and bottom deciles of outcomes. The plots in this thread are difference plots subtracting a high percentile outcome from a low percentile outcome. The minima of these plots are the points where cumulatively going forwards from that value there is the greatest excess of "good" stocks over "bad" stocks (as defined by whatever outcome you used.) Hence why they work as a cutoff. Similarly the maxima work in the opposite direction so a maximum on the function would indicate a point with a cutoff you should be below rather than above.

The main - maybe only - reason any of this turned out to be interesting was that after doing the donkey work the solution was so indicative of something a bit more interesting. The symmetry in the functions results in the median occupying a special place and allowing us to generalise rather than compute the solution for future metrics. Instead of a bunch of "magic numbers" we have the beginnings of an understanding of what is happening.

The main caveat is that (as with all things mathematical) the conclusion is only true so far as you are happy accept the conditions which get you to the conclusion. So if you want to filter by maximising the difference, this method works and it is stable. But you could argue quite effectively that you should be optimizing something else entirely - in which case none of this helps at all!

0
Avatar for Howard Adams

Hi Nick

Excellent post and screener. Many thanks.

I subscribe to UK, Europe including UK and US. And, I get Focus All Regions.

Other readers might like to note if you run Nick's screen for Focus All Regions you will get X hits (1 when I ran it).

But if you run it for Focus US (2 hits), Focus UK (o hits) then Focus Europe (1 hit). Thus, running at region level if you have several, you will get additional hits not present in the Focus All Regions run.

Regards

Howard

0
Avatar for iwright7

Nick - Many thanks - I mean QM Ranking, if it is possible to graph it? Ian

0
Avatar for Nick Ray

Ah OK. I don't collect that one so I can't produce a graph for it, although I suspect it is not going to be too different from the Q and M graphs.

0
Avatar for iwright7

Nick,

Any chance please of a similar graph for QM scores. Thanks, Ian


0
Avatar for Nick Ray

Not quite sure what you mean by QM scores. Here's the same thing for Quality Rank:

5b58a47dbfa60qual.png


0
Avatar for andrewdb

I remember your article on value rank showing that a very high score by itself did not correlate with future outperformance.
I.e. if a stock is v.v.v. cheap, that is usually for a reason.

There are studies rhat show momentum effects tend to persist, but, i would have thought in the same way as value, very high momentum ( say momentum rank over 90) is there not a mean reversion effect over a year?
I.e. at some point icarus loses his wings.

The same - i thought - would apply to quality.

I.e. screens benefit by excluding stocks that are too optimised to one criteria?

1
Avatar for Nick Ray
5b587be334185mom.png

This is the probability delta plot for Momentum Rank. It shows no sign of slowing down at higher values - if anything the slope is getting steeper. (Note how close the minimum is to the median again.) It is worth mentioning though that I do not include stocks with a Mkt Cap much below £90M or with wide spreads, so the worst of the "Momentum Trap" type stocks are not included in the data. This might be why my market median is at 65 rather than 50 as you would expect.

Clearly very high momentum cannot go on forever. However it is very hard to see on the 1-year time-frame. If it is there at all it does not kick in at 90 but probably somewhere between 98-99. This is right in the tail of the distribution where it is very noisy.

With the approach in this article though, instead of looking for super performers in just one or two metrics (e.g. very high Q and M) we look for better-than-average across as many metrics as we can. So it would be no good having M>95 but a negative Op Mgn for example.

0
Get the free newsletter