Portfolio Design

Advanced concepts in stock investment portfolio design.  Fundamentals, technical analysis and many other related topics are discussed.

S&P 500 Sector Tracking

The S&P 500 index attempts to be reflective of the various sectors in the U.S. economy. Thus a portfolio with sector weights similar to the S&P 500 should also be reflective of the US economy. This post demonstrates how to approximately mimic the sector weights of the S&P 500 in a portfolio with fewer stocks.

Stock market analysis fueled by Portfolio123.

Maintaining the S&P 500 weights within a stock portfolio is a popular strategy among hedge funds and larger private investors. Doing so means that the portfolio's performance will be similar to that of the S&P 500 while still providing the opportunity for out-performance. It also means that shorting the S&P 500 makes for a good hedge without the fear of a mismatch i.e. both the portfolio and hedge going in the wrong direction at the same time.

This post is going to use eleven custom series and twenty two custom formulas. Before starting into this strategy, I recommend creating a separate folder for your custom series and also for the custom formulas (described later). Start by going to Custom Series from the TOOLS pull-down menu.

Selecting Custom Series from the main Portfolio123 menu

Then create a New Custom Series Category as shown below.

Creating New Custom Series category

Give the new category an appropriate name such as SP500 Sectors. This is the directory where the eleven custom series, one per sector, will be saved.

Naming the New Custom Series category

Now create the first custom series, this one for the Consumer Discretionary sector.

Creating a new Custom Series

In this example, the custom series has been given the name wDiscr for (weight Discretionary).

Select the S&P 500 Index from the Universe pull-down menu. Then enter the following formula in the rule text box:

100 * UnivSum("Sector = Discretionary", "MktCap") / UnivSum("TRUE", "MktCap")

Custom series definition for the S&P 500 Discretionary sector

Migrate to the CHART tab, select Weekly as the Rebalance Frequency, set the time period to the maximum that your Portfolio123 membership will support, and click on UPDATE. When the chart has been drawn and is similar to that shown below, then click on Save.

Chart generation for the custom series

Once saved then replicate this custom series ten more times, for each of the ten remaining sectors. The formula in the RULES tab has to change each time. For example, when creating the custom series for the Energy sector, the formula in the Rule text box would be:

100 * UnivSum("Secto r= Energy", "MktCap")/UnivSum("TRUE", "MktCap")

Make sure that you select the S&P 500 Index for the Universe, and generate/save the chart with weekly rebalance.

When finished all eleven custom series then the directory of custom series SP500 Sectors should look something like that shown below.

Directory of eleven custom series

Next, twenty two custom formulas will be generated. The purpose of these formulas are to make the simulation rules easier to manage. You may be able to get away without them. Select Custom Formulas from the TOOLS pull-down menu.

Select Custom Formulas from the main Portfolio123 menu

Create two categories.

Create new Custom Formulas categories

The two categories, Sector Selection and Sector Weight, are shown below. When you are finished, you will have eleven formula under each of the two categories.

Screenshot of the two new Custom Formulas categories

Under the Sector Select category, create eleven custom formulas, one for each sector, with formulas similar to that shown below. 

Note: you may have already created some of these custom formulas in a different post.  If so, the move them to this newly created category.

Custom formula for selecting the Discretionary sector

Under the Sector Weight category, create eleven custom formulas, one for each sector, with formulas similar to that shown below. The names called up in GetSeries (i.e. wDiscr) should be identical to the names of the custom series that were created previously in this post.

Custom formula for selecting the Discretionary sector weight

Once the twenty two custom formulas have been created then it is time to create a simulation. The general simulation setup and position sizing for this demonstration are shown below. The approximate number of positions is set for 200 with a maximum weight deviation of 10%. You can set the number of positions much lower, but with lower numbers the weight resolution will be lees, and below 20 positions, this technique becomes impractical. Note that whatever number of positions you select, you will end up with about 10% less in number (see below for explanation).

Simulation general setup and position sizing

There are two Buy rules. The first rule gets the maximum sector weight for the stock being processed. This is done by determining the sector that the stock being processed is from, then calling up the weight from the corresponding custom series created earlier. The rule is:

SetVar(@Weight, Eval($Discr, $wDiscr, Eval($Tech, $wTech, Eval($Indust, $wInd, Eval($Mater, $wMat, Eval($Ener, $wEner, Eval($Stap, $wStap, Eval($Health, $wHeal, Eval($Util, $wUtil, Eval($Finan, $wFin, Eval($Real, $wReal, $wTel))))))))))) | TRUE

The second rule sets the maximum sector weight during the buy process.

SecWeight <= @Weight * 0.9

The weight retrieved from the custom series MUST be multiplied by 0.9 (or thereabouts) or you won't get a reasonable approximation for the S&P 500 index sector weights. The reason traces back to the simulation position settings. The maximum weight deviation of 10% will be applied and all the weights will be scaled up by 10%.  If the weights are not reduced by 10% in the Buy rule to compensate, then some sector weights will be too high by 10% and some sector weights will be squeezed and be much too low.

Set the end date for the simulation to be September 30, 2016. The sector allocation will be compared to an independent source for that specific date.

Simulation Buy/Sell rules and time period

The simulation has the following sector allocation as of Sept. 30, 2016.

Current sector allocation for September 30, 2016

Below is a side-by-side comparison against a third party source.

Side-by-side comparison of S&P 500 sector weights