Using Market Advance/Decline Divergence to Predict Short-Term Direction

For a few months now I’ve been tracking my own market breadth/diffusion index by hand in a spreadsheet. I realized a few days ago that I could automate it and also create historical composite data by using certain commands in AmiBroker. Since then I’ve been ruining my eyesight gazing at charts and spreadsheets, and I’ve come up with something that looks interesting.

Here’s a chart to prove I’ve been working hard:

Screen Shot 2015-04-14 at 3.11.28 PM

Here’s what I do:

For the set of Russell 3000 stocks, each day I have AmiBroker count up the number of tickers that closed at least 4% above their closing price from yesterday, as well as the stocks that closed at least 4% down. Then I calculate the ratio of advancers to advancers+decliners. Ratio=A / (A + D). That’s the column on the far right of the spreadsheet above.

I then look for divergences between this ratio and the closing price of the S&P 500. Most of the time it’s in sync, but every once in awhile it diverges. The S&P will go down while the ratio goes up, and vice versa.

Screen Shot 2015-04-14 at 2.54.35 PMThe upward red lines show potential bullish divergence, where the S&P went down and the ratio went up. The downward red lines show the opposite. The blue line is the closing price of SPY between 9/2/2014 and 4/13/15.

Ok so yes there’s a divergence from time to time, but does it hold any predictive value?

Very possibly!

60.00% of the divergence signals are followed by an up day for the S&P. Hmm, that could be useful, right? Now keep in mind I’ve only done this for the period in question, so it’s just a preliminary dip of the toe in the statistical water.

And I’m sure you’re asking yourself: is this actually better than pure chance? What if the market had “up” days 60% of the time? I’d better measure that as well.

Turns out during this period of time, the S&P closes up from the previous day 51.30% of the time. So 60% vs 51% seems pretty significant (pending further testing).

The reverse wasn’t true however. The negative divergence signal was predictive only 47.62% of the time. Perhaps the predictive power is dependent on the longer-term trend.

Screen Shot 2015-04-14 at 2.55.55 PMI don’t know if this measurement would be strong enough to trade SPY on its own, but perhaps it offers some short-term market-timing abilities when used in conjunction with other techniques. For those of you who like to crunch numbers, it’s something to explore.

4 thoughts on “Using Market Advance/Decline Divergence to Predict Short-Term Direction”

  1. I think it can also be interesting if you compare and share with us the % of profitable bullish divergences (we already know it’s 60%) with the % of up days that followed down days. So far, you showed us % of profitable bullish divergences (60%) vs % of up days that followed both up and down days (51%). I think what I say makes sense, because the bullish divergences take place in the context of a down day yesterday, so we would compare apples to apples.

  2. And my results:

    % of up days among all days (154 bars), between 02-09-2014, 13-04-2015, S&P500 = 49.35% (slightly different than your 51.3%, not sure why..)

    % of up days among all days that followed down days (77 bars), between 02-09-2014, 13-04-2015, S&P500 = 53.25% vs 60% predicted by your positive divergence

    % of down days among all days that followed up days (77 bars), between 02-09-2014, 13-04-2015, S&P500 = 54.55% vs 47.62% predicted by your negative divergence

    1. Thanks for the data Adrian! Again, apologies on the late response. WP didn’t notify me of your comment and I just stumbled upon it now.

      When I go back and look at SPY for the period in question (including the first day, Sep 2 2014), I get 78 days that were a gain out of 154, for a win rate of 50.649%. You get 77 so perhaps it’s a matter of the date-range selection?

      If I understand this and your other comment correctly, you’d like to see how the divergence signal compares to a simple mean-reversion signal, i.e. does a down day yesterday equal an up day today and vice versa?

      So in this small data set, it appears the divergence signal has a leg up on the binary reversal signal. But it’s a small set and I should probably expand it.

      One issue I have is that I don’t have historic index member data, so my breadth data gets increasingly dubious as I travel back in time. I could instead make my own index of stocks by selecting them based on minimum liquidity requirements, and then use delisted stocks as part of my data set. It’s just very slow when I use the delisted set! Still, it’s worth diving into. Thanks for the nudge.

  3. Sorry, I noticed your reply a bit late.

    Our test period started on Sept 2, which was a down day (because close on Sept 2>=Aug 29). In order to say if Sept 2 followed a up day or a down day, I needed to see if Aug 29 was an up or down day, and it was an up day. When I said “% of down days among all days that followed up days (77 bars)” I meant that the 154 days that we test, had 77 prior up days (Aug 29 is included in this number of 77 up days). So, in our testing period (154 days) I found 76 up days (Aug 29 is excluded).
    You found 78 up days in that set of 154 days, while I found 76 up days (today close>=yesterday close). And just like we have to remain good friends, it looks that both of us are right, and guilty of this is State Street Global Advisors (SSgA) which are not able to track S&P500 rigorously with their SPY ETF 🙂
    So I did this small test https://docs.google.com/spreadsheets/d/19IUTZRvbja1tmoFlqznVxhjEt5igANNEEFrPFoXTbL8/edit?usp=sharing . Data from Yahoo Finance; if data is wrong, please contact this young lady Marissa Mayer. It looks like there were 5 and 6 days in that timespan of 154 days when the daily evolution of S&P500 was different than daily evolution of dividend-adjusted SPY, and respectively un-adjusted SPY.
    Argh, all this misery of the small details of backtesting!

    Yes, you got me correctly, I wanted to see if a bullish divergence is better than a simple mean-rev, and yes, it looks it is.

    And congratulations, it seems @Quantocracy finally has a quant with a sense of humor on his radar.

Leave a Reply

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