Portfolio Design

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

Build a Market Timer Using High/Low Beta

Some technical analysts use the recent performance of high beta stocks versus low beta stocks to decide whether to be long the stock market or exit the market.  Lets turn this concept into a simple market timer using tools provided by Portfolio123 to see if it is profitable.


In the last post Supercharge Your ETF Sector Rotation Strategy, I described how to use a set of custom series to create aggregate fundamentals that could be associated with individual equity Exchange Funds (ETFs), providing those ETFs with factors that could be used within a Portfolio123 ranking system.This time, I am going to demonstrate something similar by using custom series to compare the recent performance of high beta stocks versus low beta stocks by constructing a simple market timer that switches between the S&P 500 Equal Weight Exchange Traded Fund (ETF) and the 10Y Treasury Note ETF.

Lets start by creating a "HiBeta" custom series, starting from the S&P 500 stock universe. Note that I am not defining a custom universe first. A custom universe is not actually necessary for most aplications.  In fact it wasn't actually necessary for the sector rotation strategy.

One rule, UnivCapAvg, is used. This rule provides an aggregate value representing all S&P 500 stocks that meet the criteria "Beta > 1.5". The aggregate value is the MarketCap-weighted average of the one week performance "Close(0)/Close(5)-1".

Screen shot of custom series "HiBeta" rules specification.

Screen shot of custom series "HiBeta" rules specification.

Once the rule is set up then click on CHART, and set the chart parameters for Weekly Rebalance Frequency, and MAX time period. Click on UPDATE.  When the chart has been updated then click on Save.

Screen shot of custom series "HiBeta" updated chart.

Screen shot of custom series "HiBeta" updated chart.

The HiBeta custom series has been generated. The LoBeta custom series can be generated quite easily using the Custom Series pulldown menu. Click on Save As.

Screen shot of custom series "HiBeta" being saved to a new custom series.

Screen shot of custom series "HiBeta" being saved to a new custom series.

Name the copied custom series "LoBeta" then click on SAVE.

Screen shot of custom series "LoBeta" being saved after being copied from HiBeta.

Screen shot of custom series "LoBeta" being saved after being copied from HiBeta.

Go to the RULES tab. Now it is simply a matter of changing the UnivCapAvg criteria from Beta>1.5 to Beta<0.75.  

Screen shot of custom series "LoBeta" rules specification.

Screen shot of custom series "LoBeta" rules specification.

Click on CHART and set up Weekly rebalance and MAX time period. UPDATE and Save the series. As I mentioned in the last post, do remember to use the MAX time period and do remember to save the updated chart.  Otherwise, you will have no end of troubles later on.

Screen shot of custom series "LoBeta" updated chart.

Screen shot of custom series "LoBeta" updated chart.


Both custom series have now been generated and saved. The next step is to generate the Portfolio123 ranking system. In doing so, I am going to be a bit ambitious and lay down the foundation for a bigger, more complex ranking system. Start by creating a new ranking system named Market Timer. A conditional node is added first, at the top, called Def (short for definitions). Under the True section of Def, the indicators are going to be defined.  In this post, only one indicator will be created, but in the future I can build on this by adding more nodes.

As I mentioned, Def is a conditional node. The formula used for the true/false conditions is such that it will NEVER be True. Thus I use 0=1. This tricks Portfolio123 processors into processing the True nodes, but these nodes will not contribute to the overall ranking score.  If the nodes were simply set to zero weight instead then Portfolio123 would generate an error message when the node is referenced.  The conditional node solves this problem.

Screen shot of Market Timer ranking system conditional node setup.

Screen shot of Market Timer ranking system conditional node setup.

Next a composite node called Indicator_Definition is added to the True portion of Def.  This node is set for Summation Only.  The reason for this is so that I can set up as many binary indicators as I want within the composite node.  The weight will be distributed equally, essentially making it a voting system where each indicator gets an equal vote.

Screen shot of Market Timer ranking system composite node Indicator_Definition.

Screen shot of Market Timer ranking system composite node Indicator_Definition.

Next, an ETF Formula is added, and called "Beta". This will be the only indicator defined during this post. This is a boolean indicator that is set to TRUE when the 40-week Exponential Moving Average (EMA) of the HiBeta custom series is greater than the 40-week EMA of the LoBeta custom series.

Screen shot of Market Timer ranking system indicator called "Beta"

Screen shot of Market Timer ranking system indicator called "Beta"

Now lets move on to the False portion of Def. This is where the ranking score is generated.  An ETF Formula called InMarket is added to the False condition. The rule looks at the NodeRank of Indicator_Definition, the sum of all the indicators defined above.  In our case, there is only one indicator so the rule true/false criteria is set for mid-range.  If the NodeRank of Indicator_Definition is above 50 then the rule calls out the Equal-Weighted S&P 500 ETF (Symbol: RSP).  If the NodeRank of Indicator_Definition is less than 50 then the rule calls out the 10Y Treasury Notes ETF (Symbol: IEF).

Screen shot of Market Timer ranking system InMarket equation.

Screen shot of Market Timer ranking system InMarket equation.

That is all there to the Market Timer ranking system. Now it is time to create a simulation so the ranking system can be evaluated. First create a custom universe with two ETFs: RSP and IEF.

Screen shot of custom universe defining two ETFs.

Screen shot of custom universe defining two ETFs.

Next step is to create a simulation called S&P 500EW / 10Y Treasury Notes. Set the rebalance frequency to Weekly, and the commission/slippage to zero.  (Always do this when you are first evaluation a system.)

Set the position sizing to 100% as only one ETF will be held at a time.

Screen shot of simulation position sizing set to 100%.

Screen shot of simulation position sizing set to 100%.

Select the custom universe and ranking system that were generated above.

Screen shot of simulation universe and ranking system selections.

Screen shot of simulation universe and ranking system selections.

Now comes the subtle part. Both custom series should be called up as buy rules (shown below).  They may not be needed for this simulation, but when you create a port from this simulation, these rules are necessary to trigger updates to the custom series. So they should be set now or you may forget later.

Screen shot of simulation buy rules.

Screen shot of simulation buy rules.

Lets run the simulation and see how it performs. 

Screen shot of simulation performance.

Screen shot of simulation performance.

This is not too bad for a single indicator market timer.  The average profit per trade is on the low side ~3% per trade, and there are certain time periods such as 2004-2006 where the performance is less than desired.  But if everything were perfect then life would be pretty boring now wouldn't it.

In future posts, I will build upon this basic market timer.