Using Market Breadth to Gauge Market Health (part 1)

Don't you get tired of looking at graphs? So here's a picture of a tree in Alaska that was felled by a beaver. Read whatever you want into it and the state of the markets today.
Don’t you get tired of looking at graphs? So here’s a picture of a tree in Alaska that was felled by a beaver. Read whatever you want into it and the state of the markets today.

We all want to know if it’s the right time to trade. And we’d also like to know which direction. So for at least the last two months like forever, investors have tried to come up with ways to judge how the market is doing.

One technique is to use market breadth as an indicator. There are a number of ways of doing this, but the basic idea is that you look at ALL the stocks in a particular market or index, count the ones that are meeting a particular criteria, and then use that count to determine how the market is doing.

For example, one might take a look at how many stocks in the S&P 500 are up today, versus how many are down. That’s a simple market-breadth measurement.

Simply dividing stocks into positive or negative for the day can be a little misleading though. The market might be very quiet, with more stocks negative than positive. But does that mean the market is in trouble? Not necessarily. What you really might want to look at is stocks that are very strongly negative or positive. And for that, you simply calculate diffusion.

Say you want to compare stocks that moved at least 4% in one direction or the other from the previous close. You count all the stocks that moved up more than 4%, and all that moved down more than -4%. You then calculate:

diffusion = totalup4 / (totalup4 + totaldown4)

Many breadth indicators use some threshold (like the 4%) to calculate breadth in this way. Pradeep Bonde at stockbee likes to compare stocks that are up or down 4% daily, up or down 30% over the last quarter, and some others. Brett Steenbarger at Trader Feed likes to compare the number of stocks making 3-month highs, vs the number making 3-month lows. There are a lot of ways you can measure the overall picture of the market. I set out to make my own comparisons, using a variety of metrics.

Some basics about my testing:

• I used AmiBroker for my software, and Norgate Premium Data for my numbers.

• I used historical constituents of the Russell 3000 index to test. No surivorship bias as a result.

• An analog for market health would be trading the SPY ETF when a ‘healthy’ signal was given, and exiting when an unhealthy signal was given.

• Account was started at $30,000, and the entire account was traded at once, and the resulting profit/loss compounded and traded in subsequent trades.

• I optimize over the period of 2010-2012. This was a useful time period, because it was an overall up market with some dramatic side turns down volatility avenue. I then will show how the results would have worked in the period of 2013-2015 (as of today’s date) and then, just for yucks, will show a graph of 2000-2015 for an even bigger, but perhaps less applicable picture.

• This is not meant to be a trading system per se, but an test of market-health indicators.

• These tests are probably best for determining longer-term trades. I have a short-term mean-reversion strategy for example that trades right through really bad times and still makes money. So using a longer-scale indicator like this would actually be detrimental to earnings for that type of system.

• I compare everything not with mere profit alone, but by using the CAR/MDD measurement (Compound Annual Return divided by the Maximum Drawdown). This rewards profits but penalizes big drawdowns.

• Other than this baseline test, I use diffusion for everything else. Some like to simply subtract the negatives from the positive and use that number. You could have half the market up tremendously, the other half down tremendously, and come up with a ‘zero’ for your result. I’d much rather know the percentage of positive big movers to the total of the big movers in both directions.

So first we need to establish a baseline. Many investors use a moving average of the market to determine whether it’s a good or bad time to be ‘long’. If the close is above the average, start shoveling money! If it’s not, put on your crash helmet and bar the door. Is that the best strategy? I sure hope not, because otherwise this will be a lot of words about nothing! Although it would still be good to know, right?

Investors will commonly use a 120-day moving average, and sometimes a 200-day average, and for the real go-getters, a 40-day moving average. But which is best?

So the first test is to see what results we get when entering the market the day after the close is above the MA of a certain period, and exiting after it closes below the MA. I tested MA periods from 5 to 300 days, in 5-day increments.


The best result was with a 45 day period, but it’s a little suspicious. When you see a sharp peak in results like that, usually your results will fall apart in out-of-sample testing. That’s because you just happened to land on a random patch of goodness, which you will never ever see again.

When looking at this graph, we can say that shorter rather than longer periods are better. There’s more of a plateau in the 80’s range, which might make for a more stable MA period. So let’s pick 85 days.

Now the thing about using a moving average to determine when to trade is that, if your prices are trading in a narrow range, you can get a lot of whipsawing as the close pops over or under the MA. So next I wanted to reduce the whipsawing a little, by requiring that the market have a few days over or under before entering/exiting the trade. Therefore to enter or exit a trade, I tested how many days the close should be above its moving average before entering, and using that same number of closes below the MA to signal an exit. If there are not x days of signal in a row, then the status quo is maintained. I tested from 1 to 10 days, and got the following optimization chart:


type ma 3D, 2010-2012 flg

As you can see, the 1-day requirement held its own. However longer periods of ‘signal’ come in stronger, with 10 days of signals before entering being the best of all. So moving forward, I will require all my entrances/exits to have 10 days of signals before acting. If I didn’t, this would make for some tedious testing, and the results might be spurious. Would trading one breadth indicator with 7 days of signals be better than trading a different indicator with 5 days? Seems like splitting hairs while angels dance on heads of pins.

Ok, so the big reveal: our* in-sample testing had a CAR/MDD of 0.43,  with four trades averaging 123 days each, and a 50% win rate. Here’s an equity chart for your viewing pleasure:

MA 85, 2010-2012
MA 85, 2010-2012

How did we do in our out-of-sample period?

type ma, 85, flg 10 2013-2015

We did just fine. The CAR/MDD was 0.69, with 3 trades averaging 211 days each, with two wins and one loss. The losing trade was held for a mere 27 days. Gains were higher in this period, and we can see that the doldrums of 2015 are reflected in this graph. Ah, if we could have just gotten out earlier in the Dip of October 2014. And yet we managed to miss the Falling-Down-Stairs August 2015 event. Win some, lose some.

And for chuckles and grins, here’s how our 85-day MA/10-days of signals system worked over a much longer period.


The dot-com crash was still painful, but we didn’t lose our shirt in 2008. Just our left sock and perhaps our gold Rolex.

Next post, we look at some more sophisticated market-timing indicators. But are they better? Stay tuned…


*I say “our” because, well, we’re all in this together, right? I’m not using the Royal ‘Our’ and I don’t have a team of minions that I’m speaking for.


9 thoughts on “Using Market Breadth to Gauge Market Health (part 1)”

    1. Yes they do. Here’s a link to their order form. It’s a one time additional fee of $232 to get the historical data.

      1. Oh yes I have the data… Its the actual list of all the changes on a daily / weekly basis.

        So in 1995… I am using the russell 3000 list for 1995 at that time.. then of course it changes every other day…

        So was wondering if you use the ‘changing’ historical list for your back tests?

        1. Fortunately the index is only reconstituted once a year, although mergers and acquisitions does alter the makeup at other times. The data is tagged for when it’s in the index and out of the index. In AmiBroker, one of my filter criteria is to check whether it’s a constituent at the time of the trade.

          If you use an appropriate filter system, you might not need to know exactly when it was in the index (unless you’re checking trades specifically based on add/drop from an index). Something like “price > $20 and 20-day average volume > 100000” will avoid illiquid stocks.

Leave a Reply

Your email address will not be published. Required fields are marked *