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, October 20, 2014

Buy-and-Hold/Dollar-Cost-Averaging Revisited

To take a break for a moment from rotation strategies, I wanted to introduce a strategy that I'm using for stocks that I'm looking to hold long-term. For me this includes blue chip dividend stocks that have been around for decades, have weathered through bad times and have a history of consistently increasing their dividend payout.

Timing the market is extremely hard. No one knows the future, so once invested, the only thing left to do is to adapt to changing conditions, whatever they may be. There are stocks that are on my "dividend champions" watch list, for example MSFT, that still haven't recovered to their all-time highs, even if the total market is making new highs.

Dollar-cost-averaging is a strategy advocated by many brokers and financial firms. It allows one to average out the cost-basis over time, without trying to time the market. This is great, assuming that a correcting asset will eventually rebound. It'll allow one to get back to break-even faster, since the cost-basis has been lowered from the initial purchase price. However if the asset just keeps on falling, one could keep on accumulating/compounding the losses, the whole concept approaching the principles of a martingale betting system.

So keeping in mind that if an asset is making new highs, we don't know if we're potentially buying at the top, and even if we buy on a dip we don't know if an asset will rebound or keep on falling, I created a "Buy-on-Dips" strategy, which allows one to gradually build up to a target allocation, without buying assets at the top, or without averaging down to zero.

The downsides of this strategy are that the target allocation isn't immediately reached, and that the asset could take a very long time (if ever) to recover accumulated losses.

Here's how the strategy works:

If an asset is -10% off its 52 week high, invest 10% of target amount of shares
If an asset is -25% off its 52 week high, invest 20% of target amount of shares
If an asset is -40% off its 52 week high, invest 30% of target amount of shares
If an asset is -55% off its 52 week high, invest 40% of target amount of shares
If an asset is -70% off its 52 week high, invest 50% of target amount of shares

I programmed the strategy to close the trade at a +20% profit, but one could modify this by for example taking half of the profits and trailing the rest with a stop etc. Or if fundamentally something with the company changes, where one no longer wanted to be invested, one could get out at break-even.

As a practical example, let's say that CVX (Chevron) is trading at $100 and the target amount of shares for CVX in a portfolio is 20 shares. If CVX corrects -10% from its 52 week high, one would buy 2 shares. If CVX corrects to -25% off its 52 week high, one would buy 4 shares. If CVX corrects to -40% off its 52 high, one would buy 6 shares.  If CVX corrects to -55% off its 52 high, one would buy 8 shares. If CVX corrects to -70% off its 52 high, one would buy 10 shares. After this, one wouldn't buy any more CVX, no matter the price action, until the target +20% return has been achieved (and the trade closed).

This results in the following transactions:
BUY 2 CVX @ $90 = $180
BUY 4 CVX @ $75 = $300
BUY 6 CVX @ $60 = $360
BUY 8 CVX @ $45 = $360
BUY 10 CVX @ $30 = $300

One would now hold 30 shares of CVX, with an average purchase price of $50 (totaling a $1500 investment ). To achieve a +20% return, CVX would have to climb back to $60.

The numbers I picked are somewhat arbitrary, one could probably try optimizing this strategy with TradeStation or AmiBroker, software which I don't have access to.

Here's a few screenshots of randomly picked stocks from my watchlist, showing when the strategy has bought and sold and the Profit&Loss curve below. As you can see in the first screenshot of MSFT, you would've had to wait 14 years from your initial purchase to get to a 20% profit, which is actually decent, considering MSFT still hasn't rebounded to the original purchase price levels. You could've gotten out at break-even though only about a year and a half after the initial purchase, despite the huge crash.




Below the same strategy applied to SPY, which showcases that maybe taking partial profits is better than the full 20%, because after taking profits in late 2011, there hasn't been any buy signals up to date.


Below is my current watch list of stocks, which also tells me if it's time to get in,
and with what allocation. At the bottom of this post, I've attached a link to the ThinkOrSwim BuyTheDips Strategies (5 of them in total, all to be applied in the "Edit Studies and Strategies" window). The same download link contains a text file that contains formulas for the watch list dividend yield and the indications of the current buy signals / allocations.

I've also attached a link to an automatically updating Google Drive Watchlist with the same info.





Links:

QH_BuyTheDips ThinkOrSwim Materials
QH Buy The Dips Google Drive Watchlist

Global Transportation with Commodities Rotation

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

Here's a variation of mine on the Global Market Rotation that I call "Global Transportation with Commodities Rotation" or "GTCR". I created this variation to diversify the Global Market Rotation with a somewhat different basket of funds (SSO, EEM and EDV are included in both strategies), including different asset classes that under certain economic conditions may be correlated in a different way. Commodities, for example, tend to bear a low to negative correlation to traditional asset classes, such as stocks and bonds.

GTCR uses SSO (ProShares Ultra S&P500), IYT (iShares Dow Jones Transportation Average), EEM (iShares MSCI Emerging Markets), DBC (ProShares DB Commodity Tracking ETF), AGG (iShares Barclays Aggregate Bond Fund) and EDV (Vanguard Extended Duration Treasury) as its basket of assets, and the model is based on the same calculations as the Global Market Rotation of the previous post.

At the bottom of this post are download links for the Excel file and ThinkOrSwim study that I use to show the rankings of the model.

My manual backtest of this strategy from May 2008 to May 2014 produces an annual return of +50% with a -23% drawdown, or expressed in another way, a total return of 1135%.





I also did a backtest on Portfolio Visualizer, switching EDV to TLT, which allowed me to backtest a similar strategy from 2006-2013. The CAGR was +36.66% and Max Drawdown -23.53%. It's worth noting that EDV and TLT, though both long-term bond funds, act a little differently from each other.
Also, this backtest doesn't include a cash-stop.




Links:

Global Market Rotation Model

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

Alright then, after the introductory post it's time to get to the meat of it all!

First up is a Global Market Rotation model, based on Marc Cohn's research, which is based on Frank Grossmann's research. If you want to read more about the models in detail, please follow the corresponding links on the right side of the page under "Sites I Follow".

The idea is to rotate between a basket of assets, switching allocations at the beginning of every month. The basket consists of 6 ETFs: SSO (ProShares Ultra S&P500), FEZ (SPDR Euro Stoxx 50), EEM (iShares MSCI Emerging Markets), ILF (iShares S&P Latin America 40), EPP (iShares MSCI Pacific excluding Japan), EDV (Vanguard Extended Duration Treasury).

At any given time, one is only invested in one of the aforementioned assets, based on whichever asset ranks highest at the end of each month. The previous asset is then sold and all the capital is re-allocated into the new asset.

The ranking is based on the logarithm of monthly performance over the last 3 months, and the asset rankings are compared to each other to determine the highest rank.

Also used is a cash stop filter, which determines the SSO/EDV correlation over the last 4 months. If the value is above 0.75 at the time of the switch, instead of investing into one of the assets, one would go to cash, or cash proxy SHY (iShares Barclays 1-3 Year Treasury). The idea of this is that in a global bear market, one would be invested in long-term bonds (EDV), except when the bonds are too closely correlated with the market.

It is worth noting that this strategy uses a leveraged asset SSO. Frank Grossmann suggested that the rotation strategies work better with a basket of assets that are similar to each other in their volatility, and SSO is more in line with the volatilities of the other assets in the basket than SPY.

I've created an Excel-sheet (the download link is at the bottom of the page) that I use to determine the rankings of the strategy. The data used are adjusted monthly close prices from "Yahoo Finance". My current version of the Excel sheet can automatically pull current price data from Yahoo; to do this, you'll need to go to the "Parameters" tab and click on "Get Data from Yahoo Finance".

Having created it, I'll be the first admit that the Excel-sheet isn't quite as smart as it could be.
After the allocation switch is done, I manually enter the final adjusted monthly close prices (instead of the function that refers to the current prices fetched on the "Parameters" tab). I also have to manually input the data from the previous month to the next month's table. If anyone wants to take a stab at making this more user-intuitive, go for it and please post a link to your creation!

As you can see in the screenshot below, at the moment I captured this shot, it looked
like EDV will be the clear contender for November. Of course there's still time for this to change,
since the ranks only matter at the end of the month, at the time of the switch.

The "St. Dev." column isn't used in this particular strategy.





Also included in the Excel sheet is my manual backtest from May 2008-May 2014, resulting in a +51% annual gain with -16% drawdown, or expressed in another way, a total return of 1203%.
I've also added in the months after May. As you can see, it's not all smooth sailing - the strategy also goes through troughs; the model is currently experiencing a -14% drawdown.



If you have access to ThinkOrSwim, I've also created a study that shows the current rankings of the different assets, the asset in green being the current top contender for the next month. Just add this study to any chart. The MC GMR refers to "Marc Cohn Global Market Rotation".




Please let me know if you notice any errors in any of the data, and feel free to leave comments below!

Links:
QH MC GMR Excel file
QH MC GMR ThinkOrSwim study
QH GMR Spreadsheet

Friday, October 17, 2014

And So The Journey Begins

I've been investing and casually trading for about 5 years now, always looking for a better, more profitable way to acquire wealth, with minimizing the risk as much as possible.

What worries me is what's been happening with the stock market ever since around the change of the millennium. As you can see from the picture below, for about 25 years before that buy-and-hold investing was relatively easy. However, had you bought in 2000 or 2008, you might have seen your portfolio decline over 55% in value. I don't know if I could personally stomach that kind of a move.

In a larger context, looking at the Dow Jones for about 100 years back, we also see that choppiness is pretty normal; meaning, if you're unlucky with the timing, you could potentially spend decades before seeing your account balance at break-even.


A traditional strategic allocation is usually based on holding a basket of diversified assets.
One of the best results for the last 12 years is if one had held SPY (S&P 500 ETF Trust) and TLT (iShares Barclays 20+ Yr Treas.Bond) in a 50%/50% allocation, rebalancing annually. As you can see from the screenshot below (backtested on etfreplay.com) the CAGR (compound annual growth rate) would've been +9.6% vs. just holding SPY +9.0% and the Max Drawdown -20.55% vs. just holding SPY -55.20%.



Since ETFs have a limited history, a similar backtest on portfoliovisualizer.com with correlated mutual funds FDVLX (Fidelity Value Fund) and VUSTX (Vanguard Long-Term Treasury Fund) allows us to go back to 1987. This showcases similar results, with the CAGR at +10.19% vs. just holding FDVLX +11.19% and Max Drawdown -27.44% vs. just holding FDVLX -62.24%.

Ok, so this is already much better than just holding the market, or counting on good luck with stock picking skills, or good timing with buying when the market is bottoming out and avoiding buying at market tops. However, I wonder if there was a way to (statistically speaking) increase returns without increasing the risk (Max DD) or even lowering it?

About 6 months ago I came across terminology new to me, which includes tactical asset allocation (TAA), flexible asset allocation (FAA), adaptive asset allocation (AAA) and rotation model strategies. Models based on these concepts generally require a somewhat more active investing approach vs. the traditional buy-and-hold strategic allocation method.

In the upcoming posts I'm going to showcase some of the (in my opinion) better models I've come across and open them up for discussion. Of course no backtest is going to guarantee future results, but the study of statistics is the study of probability.

As my first handout, for anyone who has access to the ThinkOrSwim (TOS) platform, here's an indicator I'm currently using that would've kept one out of the 2008 tumble, yet kept one in the market from May 2009 up to date: QH_AdvDecnCumulativeStudySTUDY

More TOS studies/strategies and Excel sheets to follow in subsequent posts.
If you're interested in learning more, please check out the "Sites I Follow" links on the right side of the page. These sites offer a wealth of information, and are the source of most of my knowledge and model strategies.