Welcome to QuantHead!

Welcome to QuantHead! I hope you find some interesting ideas here that I've encountered on my journey of learning and share your wisdom with me. Enjoy!

Monday, January 26, 2015

Cliff Smith Quarterly Tactical Asset Allocation

Jan 30, 2015 Update: Thanks to a reader, the spreadsheet has been corrected to use 3-month SMA instead of 63-day SMA as the filter.

Here's another quarterly rotation strategy that Cliff Smith presented on Seeking Alpha and backtested on ETFreplay.com, resulting in a CAGR +28.7% and Max Drawdown of -19.1%. The idea is to invest in the top asset of a basket of seven funds (or their corresponding ETFs) at the beginning of each quarter (January, April, July, October), unless the adjusted close price of the top ranking asset at the time of switching is below its 3-month simple moving average, in which case the allocation is VUSTX (or TLT/TLO).

The rankings are based on 105-day returns (weighted 50%) and 20-day returns (weighted 50%), based on adjusted close data from Yahoo Finance. As usual, I've created an automatically updating, dynamic Google Spreadsheet to help with the rotations.




QH Cliff Smith Quarterly TAA Spreadsheet



Thursday, January 22, 2015

Simple Pair Switching Google Spreadsheet

I've created an automatically updating Google spreadsheet for the previously introduced strategy "Simple Pair Switching", for those that don't have access to the Thinkorswim platform (or like me, who find it slower to login and load to TOS than load a web page).

The numbers in the ranking column don't match the values of TrendXplorer's TOS study. However,
I went back a few years, and the signals are pretty much spot on at the same exact places.

I used non-adjusted daily close data to stay faithful to TX's original study.



QH Simple Pair Switching Spreadsheet

Sunday, January 18, 2015

Universal Rotation System Backtesting Tool v0.51

Feb 02, 2015 Update: Thanks to a reader, the tool has been fixed to correctly display rankings with 7+ assets.

Right then, here it is: "Universal Rotation System Backtesting Tool".

It attempts to execute a similar process as Portfolio Visualizer and the ETFreplay.com, without being limited to backtesting to the end of the previous year, or a subscription fee.

Having already put quite a bit of effort into it, I'm hoping that this will become an open source project, where anyone who wants to take a shot at fixing or making it better, can share their work with others.

In addition to fixes/making it more intuitive, my hope is that folks will want to expand on this, add more variables, including volatility (and weighting for the volatility), multiple aggregation/ performance periods with weightings, as well as "Top 2" and "Top 3" as options, cash stop and moving average filters, or whatever else they might think is useful. If you are inspired to update the latest version in any way, please send me an updated version and I'll upload the latest version for everyone's benefit and to build upon in future updates.

Note that of the yellow fields, which contain variables that can be changed, currently everything but the "Top 1" field is active. ONLY change the data in the yellow fields. Also worth noting is that you have to enter a start/end date that's after the actual start/end date of the aggregation period data point: meaning, if you select 9/1/2014 as the starting date for a monthly strategy, but as the period didn't start until 9/2/2014 because of Labor Day being on the 1/9/2014, you'll get error messages. In which case, you can for example select 9/2/2014 or 9/3/2014 instead, and it'll work fine.

There is enough "space" for 20 years of monthly backtesting, but the space for longer backtest periods may become limited when backtesting weekly strategies (also an area to expand on in the future). You can backtest to an earlier point in time than where all the assets have data from, however these assets are obviously not taken into account before they existed (populating synthetic data for any missing asset data might be an area to expand on in the future). The first asset should in these cases be the oldest asset, since the date is drawn from the "Asset1" tab.

As usual, I don't guarantee any of the data or calculations presented being correct and this tool should only be used as an informational device. Please let me know if you spot any errors, or want to improve on this but need more information on how the tool "does its magic"!


QH Universal Rotation System Backtesting Tool 0.51

Friday, January 16, 2015

Universal Rotation System Backtesting Tool

Here's a little teaser preview of what I've been working on lately:
I started building a dynamic Google spreadsheet to test out rotation strategies.

It currently allows you enter the assets (max.10), aggregation period (weekly, monthly, quarterly), performance period, start date and end date. For example If you select "Monthly" as the aggregation period and enter "3" as the performance period, the backtest will look at the assets' relative performance over 3 months. As soon as any variable is changed, the spreadsheet will pull data from Yahoo Finance, and populate backtest results, showing the allocations for each period, the returns for those allocations and an equity curve and stats for the backtest period. It will also show the equity curve and annual return of SPY as comparison.

The idea is, time and energy allowing, to eventually add more variables, including volatility (and weighting for the volatility), multiple aggregation/performance periods with weightings, as well as "Top 2" and "Top 3" as options.



Thursday, January 8, 2015

Dynamic Google spreadsheets

I've created automatically updating, dynamic Google spreadsheets for various previous strategies, including GMR, GTCR, Simple GMR and Fidelity Sector Rotation. All of these use adjusted close data from Yahoo Finance. Links to the spreadsheets can be found under the corresponding strategies.


Monday, January 5, 2015

Modified Dual Momentum

Jan 6, 2015 Update: The spreadsheet has been updated to take volatility into account in the rankings.
May 9, 2015 Update: Thanks to a reader, the 63-day volatility for TLT now points to the right data.
May 20, 2015 Update: Thanks to Gene Wildhart, the volatility calculations have been changed.

Gary Antonacci recently published a book "Dual Momentum Investing" that has raised quite a bit of discussion in the quantitative investing community. The idea was that he combined relative momentum (how assets are performing compared to each other) and absolute momentum (how assets are performing in comparison to short-term treasuries). He backtested his strategies with decent results over the last almost 40 years, but because the U.S. stock market has been so strong in the last few years, the strategies have lagged, compared to the U.S. stock market. For a lot of people, myself included, the goal is to beat the U.S. stock market and it's hard sticking to a lagging strategy year after year.

Scottsinvestments.com created a strategy inspired by Antonacci's Dual Momentum, but it has also lagged the U.S. stock market in the last few years, providing an annualized return ~ +8% over the last 5 years.

After reviewing Antonacci's book, Lowell Herr from ITA Wealth Management stepped up and modified the dual momentum strategy to have a better performance over the last few years, by increasing the number of securities for inclusion in the portfolio, shortening the look-back period and rebalancing every 33 days, which has the rebalancing date float throughout the month, rather than always at a specific date. Whether these changes are curve-fitted to improve the performance in certain conditions, or improvements leading to a robust strategy, remains to be seen going forward.

In Lowell's model, a 50% weight is assigned to 3 month (quarterly) performance, a 30% weight to 6 month performance and a 20% weight to 63-day volatility. Every 33 days equal amounts are invested in the top 2 ranked securities, unless the ranking is worse than SHY (cash), in which case one or both securities are replaced with SHY (cash). The green curve below is his backtest with these figures, providing ~+20% CAGR over the last 8 years.




I created an automatically updating Google Spreadsheet that shows the current rankings, based on the same weights of performance and volatility as Lowell uses. It will highlight the top 2 assets in green, unless their performance is worse than SHY. All assets ranked below SHY are highlighted in red. All one needs to do is check the spreadsheet every 33 days or so and re-allocate to the (new) green securities.

Schwab commission free substitutes are also provided.






QH Modified Dual Momentum Spreadsheet

Fidelity Sector Quarterly Rotation

Jan 8, 2015 Update: By a reader's request, I've also created an automatically updating Google spreadsheet, which uses adjusted close prices.

On a previous post highlighting Seeking Alpha contributor Varan's strategies, I touched on a strategy called "Fidelity Sector Rotation". This strategy looks at the 8-week performance of 44 Fidelity Sector funds and a Vanguard Long-Term Treasury fund at the close of the first week of each quarter, and invests in the top performer for the following quarter.

Varan backtested the strategy for the period 1991-2011 with CAGR +25% with a maximum annual loss of -11%, beating the S&P500 index in 17 out of 21 years. Forward-testing it up to date, the strategy returned +1.74% in 2012, +38.5% in 2013 and +18% in 2014.

To help with the rotations, I created a ThinkOrSwim study that automatically updates and shows the current leader of the basket. All one has to do is to check this after the close of the first week of each quarter (first week of January, April, July and October). The only difference to Varan's study is that the prices used are close prices and not adjusted close prices (dividends and splits not taken into account).

The funds are commission-free with a Fidelity account, but since I don't have a Fidelity account,
and fund commissions are somewhat bigger for me than ETF commissions, I also created a list of ETF substitutes. It is worth noting though that some of the ETFs track the corresponding fund's performance better than others, so to use the strategy in its most pure way, the sector funds should be used, rather than the ETFs.






QH Fidelity Sector Rotation TOS Study

QH Fidelity Sector Rotation Spreadsheet

Saturday, January 3, 2015

2014 Year in Review

Feb 01, 2015 Update: Thanks to a reader, a couple of typos have been corrected in the GMR returns.

It's time to see what worked and what didn't for 2014, in order to adjust going forward. The disappointing news is that most of the ETF rotation strategies I follow, greatly underperformed, if compared to just holding the US stock market (SPY) or utilizing the "KISS Low Volatility Rotation" strategy, which basically had you invested in SPY for the entire year. The only rotation strategy that narrowly beat the market was "Simple Pair Switching".

Of the other strategies, "Buy the Dips" worked well throughout the year and so did "Hedged Convexity Capture".

Benchmark (SPY): +12%
KISS Low Volatility Rotation: +12%
Global Market Rotation: +3%
Global Transportation with Commodities Rotation: +5%
Simple GMR: +4%
Simple Pair Switching: +13%

A bit disappointing for the rotation strategies that backtested to beat the market every year.
A good lesson for the new year to stay diversified with various strategies and good reminder that
even with rigorous backtesting, past performance doesn't necessarily indicate future performance.

Below is the breakdown of the signals, returns and cumulative returns for the rotation strategies for 2014.