Category: Regime Change

Using SPY as a regime switch

A question that we receive with some regularity is "can I run a backtest that changes strategy based on whether SPY is above or below its 200-day Moving Average?"

The answer is yes. We have a group of backtests that switch between strategies depending on the prevailing regime.  These regime backtests build up on the logic of the Ratio MA backtest and come in 2 varieties:

With these two backtests, when the ratio is above its MA the backtest runs the Regime 1 portfolio / RS strategy (i.e. Risk On).  Conversely, when the ratio is below its MA, the Regime 2 (Risk Off) portfolio is chosen.

If, rather than using a ratio, you want to switch strategy based on whether or not SPY alone is above / below its 200-day MA,  then you can use XZERO as the Regime 2 security.

XZERO is simply a zero return index (i.e. it's a constant), so an MA of the ratio SPY / XZERO is the same as a moving average of SPY itself (see the Parameter Summary comparison at the bottom of this post).

 

Regime RS backtest that uses the SPY 200-day MA to determine the regime

Note:  Moving Averages on ETFreplay are calculated using Total Return.  i.e. the calculation does not just use closing prices but also accounts for the receipt and reinvestment of any dividends and distributions.  The MA is then compared to the Total Return value of the ETF, so that it's like-vs-like; everything is Total Return, not just price.

See:

 

SPY MA Parameter Performance Summary on the left. SPY / XZERO Ratio MA Parameter Summary on the right. The backtest returns are the same.

Using a Regime Ratio to switch between Mean Reversion and Relative Strength strategies

This example employs a simple credit spread style ratio to define the prevailing risk on / off regime and uses that to switch between different strategies.

When the High Yield / Treasury ratio is trending upwards (i.e. short MA above long MA) the backtest pursues a mean-reversion strategy, investing in the weakest short-term performers (buying wholesale) in a list of broad U.S. equity ETFs.

Conversely, when the HYG / IEI ratio trends down (short MA below long MA), the backtest switches to a Relative Strength strategy; buying the top five from a list of mixed asset class ETFs.   Selecting the strongest five securities from the list provides some diversification while also giving the backtest the opportunity, in bear markets, to allocate 80% to fixed income and, in the most severe periods, to avoid equities entirely. 

 

 

Specific parameters and ETFs are not the focus of this example, rather, it is intended to highlight the backtest functioanlity and to provide a starting point for subscribers to further research and develop.

Using a Regime ETF Backtest To Address Market Cap Weighting Skewing Benchmark Returns

This model is simple yet addresses an important issue for those that want to compete against a benchmark.

In order to compete against a specific benchmark, it makes sense to understand that benchmark.   If you totally ignore it, you can do great but at times you will probably get frustrated because your strategy is totally out of sync.

So take the example of a logical model of  S&P Equal Weight vs NASDAQ Equal Weight.   This is a pretty good indicator but at the same time, the S&P Equal Weight is wildly different portfolio than the weighted S&P because of the fact that market weight S&P is strongly skewed to the big, very profitable money-making S&P names (AAPL, AMZN, MSFT etc).  

This backtest addresses that by using our Regime model.  It still uses S&P EW vs NASDAQ EW as its indicator -- but then when it comes to actually buying and selling, it uses market cap weighted QQQ and market cap weighted OEF (S&P 100).  

Take a look;

Regime Driven Mean Reversion

Late last year we produced a video that showed how two different strategies, relative strength and mean reversion, could be layered on top of each other.  That example went through each of the constituent backtests separately, in order to explain the mechanics of the process.

The example below shows how such a dual-layered strategy can be run in a single backtest.  The first layer employs the SPY / VEU ratio moving average as a regime switch to dynamically alternate between whichever is stronger; U.S. or International stocks.  Then, the second layer picks the weakest short-term performer within that chosen asset class.

To keep it simple, we have used the same basic U.S. (MDY, IWM, SPY and QQQ) and international (EWA, EWC, EWH and EWS) ETFs that we have used in previous examples.

Strategy Diversification: Combine a core allocation with regime based portfolio switching

Back in 2010 we created our first multiple strategy module, the Advanced Relative Strength backtest, allowing subscribers to combine together different models into an overall portfolio.  To illustrate the backtest, we produced a simple example that employed two sub-strategies; a basic US equity model (MDY, IWM, SPY and QQQ) and an international model using smaller developed country funds (EWA, EWC, EWH and EWS).

The example below uses the same ETFs as that original illustration, but this time, rather than running each model concurrently, we have employed the SPY / EFA ratio moving average as a regime switch to dynamically alternate between the two portfolios.  When the SPY / EFA ratio is trending upwards (i.e. above its MA), the backtest invests in the US equity portfolio.  When the opposite is true, it switches to the International stock portfolio.  This regime approach is then mixed with a solid fixed income core portfolio (IEF and LQD) to form an annually rebalanced 60-40 strategy.

 

 

The Core-Regime Portfolios backtest is available to pro subscription members.

123