Portfolio Design

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

Business Cycle Ranking System: Adding a Recovery Indicator


In the most recent post Business Cycle Recovery Revisited, I created a custom series called "Sales-Earnings YoY".  Now I am going to add this series to the Business Cycle Timer ranking system and run a simulation, just to see what the Sales-Earnings really looks like when put to the test.

Stock market analysis tools provided by Portfolio123.

First, lets start with a little recap from yesterday.  Most of my effort involved development of the custom series "Sales-Earnings YoY", which is shown below.

Sales-Earnings Year-over-Year custom series

In addition to this series, I did some exploratory work using "Inventory" and "Inventory YoY". I also expressed the need to find some activity indicators, fed stimulus, etc. For today, I am strictly focusing on adding the Sales-Earnings YoY into the ranking system. If you haven't built the basic structure of the ranking system yet, you can find a description of how to do so here: Market Timer: Business Cycle Approach.

The custom series is going to be deposited in the Lib section at the top of the ranking system, under Fundamental. You may have your own structure so tailor these steps for your own design.

Screenshot of Business Cycle Timer ranking system with the addition of the formula for Sales-Earnings-Recovery

The reason I have a library at the top is so that I can keep all my indicators in one place.  If I want to use them somewhere else then I can simply copy the entire node into a new ranking system.  The alternative is to comb through your entire ranking system looking for rules that you may need, and then copy and paste them individually.  This usually ends up being a real pain, and an error-prone process. Also, when making modifications, I usually only have to edit the formulas in the lib area. The rest takes care of itself.

As shown in the figure above, I have named the node "Sales-Earnings Recovery". The logic is:

(EMA(5, 0, GetSeries("Sales-Earnings YoY")) / EMA(52, 0, GetSeries("Sales-Earnings YoY")) > 1) & (LowVal(102, 0, GetSeries("Sales-Earnings YoY")) <1 )

An English translation of the logic is as follows:

IF the 5 week Exponential Moving Average (EMA) of "Sales-Earnings YoY" is greater than the 52 week EMA of "Sales-Earnings YoY"


IF "Sales-Earnings YoY" has been less than 1 within the last 102 weeks (2 years)

THEN the node "Sales-Earnings Recovery" is set to TRUE

ELSE the node "Sales-Earnings Recovery" is set to FALSE

As you can see from the above logic, I have put an expiry date of the recovery indicator that is two years from when the indicator was less than 1 (meaning Sales-Earnings recession). Now this time period is arbitrary. I have chosen it to be a fairly long recovery period (in my opinion) because I can resolve overlaps between the recovery phase and expansion phase later on in the ranking system.  So it is better to be too long than too short. Resolving overlaps is out of scope for this post, I am only focusing on the task of adding the recovery indicator.

The next step is to add the recovery indicator under "Recovery" in the ranking system. The node "Recovery1" simply calls up the rank of the "Sales-Earnings Recovery" node that has already been added to the lib(rary).

Screenshot of Business Cycle Timer ranking system with the addition of the Recovery1 node

Remember to delete or modify the old Recovery1 node that was put there as a placeholder. It is no longer needed.

The figure below shows the setup you need for the rest of the ranking system. The formulas are given in text form in the previously-mentioned post if you need to do a cut-and-paste. These nodes need to be set it up exactly as is without asking any questions, otherwise you will have problems.  All will become apparent in due time.

Screenshot of Business Cycle Timer ranking system with the remaining setup needed to make sure the ranking system functions correctly

Now that the ranking system has been updated, save it and then move on to the simulation. The most convenient way is to open up a separate window on your PC so you can alternate between ranking system and simulation as need be.

When you run the simulation, make sure you have selected the custom universe that calls up the ETFs RSP and IEF as shown below.

Business Cycle simulation universe and ranking system selection

Make sure the custom series "Sales-Earnings YoY" is kept up to date by adding Close(0,...) as a buy rule as shown below.

Business Cycle simulation new Buy rule(s)

Also, only allow the ETF RSP to be processed, ignoring IEF.  Make sure that the buy rule Ticker("RSP")&RankPos=1 is there from previous run.  If not, then add the buy rule. Now for the good news and bad news. First the bad news...

Business Cycle simulation results

The recovery rule did quite a good job identifying the recovery phase after the 2001 recession. But for the 2009 recession, the indicator showed up drunk and late to the party. Well, we knew this was going to happen, as it is a lagging indicator. And it is reality. We are modeling the business cycle, not the stock market.  This is also one reason why I don't like defining a theory then testing data.  There is a bias involved where I want to force the data to fit my theory.

Now for the good news.  If I had chosen this indicator prior to 2008, I would have thought that it was brilliant, perfectly sync'ed and the only indicator I need in my toolbox.  How wrong this would have been!

So while this indicator is a lagging indicator, it is doing its job identifying sales and earning recovery.  This is determined after companies issue their quarterly reports and EMAs are applied.  What isn't being done at present is looking for activity that might suggest a recovery prior to this indicator going positive.

I am going to keep the indicator because it is part of the solution, but not the entire solution. Now, I am going to try to find additional indicators and add them to the ranking system as shown below.

Business Cycle Timer ranking system addition required to build up the recovery indicator

 It will be another voting system just like for the Market Timer, except it is for modeling the recovery state in isolation.  Once that has been accomplished, then I will do the same for contraction and expansion.  Then, I start in on modeling timers for each of these business cycle states.

All for today.