SPY: Significant improvement to next day returns by tracking XLV/XLU

In part I. you have seen how correlation of two sector ETFs can be used to predict SPY results. In part II. I’ve taken this to a next level and looked at absolute sector performance to improve SPY next day results. I checked a number of different ways. I looked at one sector outperforming another. I looked at the strongest sector only etc. At the end I find it best to look at the performance of a specific sector. The problem looking at specific sector strength, it changes over time. During the recent bull run it’s been important that financials were among the leaders. Where as in the past other sectors have been leading the bull market. Weakness in specific sectors such as healthcare or utilities has been most predictive in identifying good times for the stock markets.  Sector ETFs carry important information in terms of market health.  A lot of money is still invested in long only funds. For these funds the only way to “hide” during bear markets is to park money in defensive sectors (=low volatility and high dividend). Typically these companies are part of the utilities or healthcare sector.

Let me underline that with some facts.

I looked at next day returns in a bull markets (ROC200>0) since 1999. The table has 5 columns. The first showing benchmark results: SPY next day return in a bull market. The second column showing SPY returns after a down day. Column three and four representing SPY performance after a down day in on of the sectors XLV/XLU. The last column showing performance when either XLU or XLV is down.

All returns could be captured with XLV as well as XLU, while all KPIs other than MaxDD% could be improved!

But hold on, we aren’t done yet.

So far this has been an extremely simple test. I looked at more pronounced weakness. Instead of using a down day criteria I applied ROC (9) <0 as a filter to XLV (Healthcare).  Again, further improved results.

Different volatility regimes

Then I thought how might this perform under different volatility regimes. For identifying different regimes I simply used ATR10 and ranked it with PERCENTRANK. Value >0.5 means high volatility environment and <0.5 indicates low volatility environment. Depending on the volatility environment is used different ROC settings (high volatility 9 bars, low volatility 15 bars)

I think the results are good. Please be aware, that i don’t think this makes a trading system. You should rather use this to improve your money management or for timing your entries.

I encourage you to further look into sector ETFs. I’m still not done. Any feedback or comment is highly appreciated.

Amibroker AFL Code

#include ;
#include ;
SetCustomBacktestProc("formulas\\include\\cbt_midlevel.afl",True);
SetOption("CommissionAmount",0.00);
SetBacktestMode( backtestRegular);
SetOption("MaxOpenPositions",1);
SetOption("MaxOpenShort", 1);
SetOption("MaxOpenLong", 1);
SetPositionSize( 100, spsPercentOfEquity );
SetTradeDelays( 0, 0, 0, 0 );
Short = Cover = False;
Buy   = Sell  = False;
ApplyStop( stopTypeNBar, 1, 1, 0, False, 0 );
Vola  = percentrank(ATR(10),252);
Buy   = Year() >= 1999
        AND ROC(Close,200)>0
        AND ( (vola<50 AND ROC(Foreign("XLV","Close"),15)<0) OR (vola>50 AND ROC(Foreign("XLV","Close"),9)<0) );

Comments

  1. Carl says:

    Hi Frank,

    Once again good insights into filtering and trading rules. I think a key measure to add as a Key Performance Indicator (KPI) is the average gain per trade. It will help assess the likely profitability of the system after friction. This KPI becomes especially important as we look at ETFs, which unlike indexes that have Rydex and other frictionless vehicles, will have frictions that can erase small average profits.

    Carl

  2. Joe says:

    I personally like to use avg $/share. Like the avg gain, gives me the profitability after ‘friction’. Knowing my commission rate, I can deduct from this stat to get better feel of profitability.

  3. Tex says:

    Hello Frank,

    I’m following your blog since some days, very good wook indeed.

    I was wondering where I can find the code for the PERCENTRANK indicator. Can you be of some help here ?

    Thanks

    Tex

    • Hi Tex,

      happy to hear … good trading

      Frank

      function PercentRank( Data, Periods)
      {
      Count = 0;
      for ( i = 1; i Ref( Data, -i ), 1, 0 );
      }
      return 100 * Count / Periods;
      }

      • Tex says:

        thanks Frank,

        I’m actually struggling to understand the formula as I use tradesignal which understand easylanguage.

        Is the code something like:

        Inputs:
        Data(Close),
        Period(252);

        Count = Sum (Data,Period);

        DrawLine ( 100 * Count / Period , “PercentRank”);

      • For some reason not the entire code has been copied .. sorry

        function PercentRank( Data, Periods)
        {
        Count = 0;
        for ( i = 1; i Ref( Data, -i ), 1, 0 );
        }
        return 100 * Count / Periods;
        }

      • Send me an email fhinbox-tarding (at) yahoo.de … I’ve got the function in TradeSignal as well.

        I stopped using TradeSignal some time ago: i didn’t find it good for system development and trading furthermore it’s to expensive.

Trackbacks

  1. [...] ground. Frank Hassler recently wrote a good article about using sector returns to predict the SPY: http://engineering-returns.com/2010/08/08/spy-xlv-xlu-sector-performance/. This article showed essentially that when defensive sectors are falling, the S&P500 does [...]

  2. [...] include sector information in my SPY trading. In the past I looked at a couple of different ways (link). The main issue with my past approaches:  sector relevancy changes during the economic cycle. [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 226 other followers