Category Archives: Other
Deeper into the rabbit hole we go…
I’ve been playing around with automating trading system generation and evaluation. It’s been crude and slow so far but has been a good learning experience. One of the things that’s come out of this is my thinking about whether short term strategies exhibit a sort of persistence (good results followed by good results) or mean reversion (poor results followed by good results).
There’s no good reason I can think of that either has to be the case. Still, it’s something that can be looked at when evaluating a strategy.
Let’s think about a simple mean reversion system – holding SPY when it’s below its 10 day moving average. The inverse of this, a follow through system, will hold SPY when it is above the 10 day moving average. Ok, how does the mean reversion strategy perform when it has recently outperformed or underperformed the follow through strategy? Below is a chart with results based on a 20 day look back period.
In this case recent underperformance has been a good predictor of strong future performance (especially since 2008). Recent outperformance has been followed by so-so to poor performance.
This makes me wonder what other simple systems show similar trends if we apply the same type of analysis.
Back in September of 2012, I ran a series of posts on profiting from XIV monthly follow through. I showed how such a strategy did very well historically.
Well, it turns out my timing for these posts could not have been worse. Perhaps they marked the top of such a strategy?
Consider the chart below showing both monthly follow through and monthly mean reversion for XIV using both simulated values from the futures and actual values once brought into existence. (Note: defining monthly follow through as holding XIV through the current month if it rose the prior month and mean reversion as holding XIV through the month if it declined the prior month). The chart runs from 2004 to September, 2012. As you can see, the monthly follow through strat dominated.
What happened after I published my series of posts? Check out the chart below which shows performance between September, 2012 and the end of 2013. The tables turned and monthly follow through took a hit while monthly mean reversion prospered nicely. XIV decided to be less trendy and more choppy.
What’s also interesting is that September, 2012 marked the beginning of a period when not only monthly mean reversion did well but daily mean reversion did well, too. I documented that in this post.
Monthly follow through hasn’t looked bad since last September. Maybe the relative under-performance was just a phase.
Happy New Year!
This is a follow-up to the popular post I did last January on using weekly closes in VXO to time the SP 500. In that post I showed it has historically been much more profitable to own the SP 500 following weeks when VXO rose vs. weeks when VXO declined. Beautifully simple.
In this post I’ll add another indicator to the timing model. Just a bit more complexity. This indicator will show that many weeks following a VXO decline are really not that bad. We can separate those that have tended to decline from those that tended to rise.
The indicator I’ll introduce is an acceleration measure based on SP 500 weekly highs and weekly closes. First I calculate each week’s high divided by the previous week’s close. The final indicator just looks at whether this number increases or decreases from week to week.
In other words, is HIGH t/CLOSE t-1 greater than or less than HIGH t-1/CLOSE t-2 ? I’ll refer to the high divided by previous close as H/C in the rest of the post.
In the chart below, you’ll see three equity curves. One invests in the SP 500 whenever VXO declines the prior week. The other two will distinguish weeks with an accelerating H/C vs. weeks with a decelerating H/C.
Nice. As you can see, the index tends to fall when H/C accelerates and rise when H/C decelerates. We are also closer to having a decent short setup based on times when VXO declines and H/C accelerates. We can make the short trade more appealing by simply requiring the previous week’s VXO close be above 19. A VXO close of 19 works well but other values around it work well too.
The below chart shows profit curves for investing in the index when VXO declines, H/C accelerates and either VXO closes above or below 19 the prior week.
Finally, let’s combine all long and short trades together. Here is how the final model rules could work.
Long SP 500 when either VXO rose or when BOTH VXO declined and H/C decelerated.
Short SP 500 when VXO declined, H/C accelerated, and VXO closed greater than 19.
Cash when VXO declined, H/C accelerated, and VXO closed less than 19.
Below are equity curves for buy and hold, a long only model, and a long/short model. Not bad.
Cheers and best of luck to you in 2014!
**Technical note: All data are from Yahoo finance and exclude dividends, commissions, fees, slippage, etc. etc.
Update: Here is an Excel file with data and calculations for the last chart. Enjoy! SPY VXO Weekly Strat Part 2
Update2: Here are some stats that were requested.
I was browsing my twitter feed this week and saw a couple old Quantifiable Edges posts (here and here) linked to by @PsychTrader. The two posts were written in mid-2009 and detail a simple weekly strategy that uses the relative performance of the S&P 500 and Nasdaq indexes to time the market. They showed how investing in the SP 500 or Nasdaq when Nasdaq has been outperforming (based on 10 week relative performance) has generally beat out buy and hold.
Since the posts were written a while ago, I took it on myself to test out the strat with recent data. I used SPY and QQQ weekly data from Yahoo Finance for my test. I compared price performance (adjusted for dividends) over 10 week periods. All performance calculations and trades take place at the end of the week. One tweak I made was to add a lagging week between a signal change and when a trade takes place. An example – if at the end of a week SPY goes from outperforming to underperforming over the past 10 weeks, I will not adjust holdings until the end of the following week. This seemed to enhance returns but results will be similar without it.
Below I will examine holding QQQ or cash depending on whether QQQ is outperforming or underperforming SPY. I’ll leave it to the reader to test holding SPY.
First let’s look at the period from 1999 (inception of QQQ) to the end of 2008. The strategy to invest in QQQ when it underperformed SPY got crushed during the bear markets and just treaded water during the bull market. The inverse strategy did much better and held its ground through bull and bear period alike.
What happened from 2009 forward? Take a look.
The strategy that sucked big time before has been steadily rocketing higher while the formerly better strategy has been treading water.
I guess this is just another example of strategies being turned on their head at the market’s whim. This is one I’ll be keeping tabs on going forward.
On a personal note, I’m proud to announce that my wife recently gave birth to our first child, a beautiful baby girl. We are greatly blessed if a bit sleep deprived. Still trying to keep up on markets but can be challenging while juggling my new dad responsibilities. :-)
I sometimes wonder if there’s anything useful in the volume data accompanying daily OHLC values from sites like Yahoo, et all. I haven’t had much success in the past. I’ve mostly ignored it.
Well, I got inspired to give it a go again and think there’s potential to use volume to enhance a trading system. Enough data mining can solve any problem, right?
I’ll describe a system I tested on various index ETFs and then compare the results with and without a volume filter. My goal isn’t to prove the system is great, just that using volume can potentially enhance a system’s profitability.
Ok, here are some rules for a base mean reversion system:
Buy at the close when 1) the close value is less than yesterday’s close AND 2) the close value is at least .5% below the 10 day SMA. Sell position 4 days later at the close.
Now we’ll add a volume filter:
In addition to the previous criteria, only buy at the close if current day’s volume is less than the volume of EITHER of the previous 2 days. (Note: we could use 1 day or 3 days, the farther out you go the less restrictive this filter becomes).
I think my initial thought was that buying on a bigger volume day would be better. Perhaps signaling capitulation. But no, a lower volume day is better in this case. And I guess that makes sense too as a type of negative divergence or perhaps exhaustion of sellers.
Here are some summary results for the system with and without the volume filter. Each ETF is tested from inception to July 9, 2013 using Yahoo Finance data.
The volume filter cut down significantly the number of trades. While total profits of the backtests were lower, the average trade profit and winning percentages were generally improved.
I’ve attached an excel book containing the backtest, summary stats, and profit curves for each ETF. Enjoy!
Excel Download – Trade System with Volume Filter
This morning I placed an interfund transfer request in my TSP account. This is a discretionary override of my systematic TSP strategy. I changed allocations to 25% C 75% G funds for my existing balance. I will keep a 40% C 60% G fund allocation for new biweekly contributions.
I’m getting more and more bearish for the rest of the year. What does this mean? Probably that the market is about to soar and you should load up on stocks. Well, maybe not…
We’re pretty far above the 200 day average and near all time highs and in a very mature bull market. I could be wrong but am playing it safe(r) here.
The allocation displayed in the top right of the site will continue to reflect the 40/60 allocation until an official strategy change occurs.
On a side note, XIV daily mean reversion (long only) has continued to crush daily follow through since my March post. I’ve been keeping an eye on it and playing it occasionally. I’m sure it will stop working eventually but am enjoying it (in small sizes) while it lasts.
On another side note, my life has been pretty hectic recently and I haven’t been able to do much of the market research I love. I’m hoping things will calm down by the summer.
Question: What’s one way you could have nearly doubled your money since last September with minimal drawdown?
Answer: XIV daily mean reversion! Well, a long only approach that is.
Daily mean reversion just means holding XIV if it declined in price the previous day. Daily follow through would be holding XIV if it increased in price the previous day.
Daily mean reversion was hardly a good strategy in recent years. In fact, since 2009 when VXX came into existence, this strategy performed relatively poorly while a daily follow through strategy did fantastic. That changed last September. I have no clue why.
Check out the chart below illustrating the recent performance of the two series.
One note, if one looks at simulated XIV before 2009 you can see this isn’t the only time mean reversion would have dominated. The same thing would have happened in 2007/2008. Is there anything to be read into that? Possibly not. Could just be random changes in the market.
There’s no telling how transitory this change will be. Just thought it was worth sharing.
Technical note: I just used inverse changes in VXX to create the series for the chart above. Good enough for illustrative purposes.
Every so often I come across a post or comment on some kind of XIV/VXX pair trade. I wrote one such post in 2011 toward the beginning of my volatility research. I thought I’d write another post now to shed more light on some of the ideas that get thrown around.
I’ll examine 3 types of trades here:
- Long XIV and long VXX
- Short XIV and short VXX
- Long XIV and short VXX
For each type of trade I’ll examine a 50/50 allocation (e.g. 50% short XIV/ 50% short VXX) and examine all the past outcomes of holding this trade 60, 90, and 120 days out. I’ll leave it to readers to try other combinations of weights, time lengths, and any fancy embelishments.
Note: Values before product inception are simulated based on the VIX futures .
Long XIV Long VXX
This pair goes long both products. The hope is that one of these breaks out and rises significantly from the purchase price. As an example, assume XIV rises around 100% over an extended period and VXX falls around 50% over that same period. In this case, the pair trade would be up 25%. If the returns are flipped around, the pair would still be up 25%.
This chart shows the return profile of purchasing the pair on the specified date and selling 60, 90, and 120 days later.
I was surprised by a couple findings while doing this analysis. I’m sure others have thought of them but they are new to me. These findings include:
- This pair only does well when a long XIV position outperforms a short VXX position over the specified period. In a sense, this pair is betting on that to happen.
- The returns of this pair are slightly negatively correlated to equities and nearly uncorrelated to government bonds. This presents promise as a portfolio diversifier.
Of the three pairs, I like this one best. Negative returns are subdued while positive returns can be quite high. It’s also the easiest trade to execute consistently as you don’t have to worry about finding shares to short.
Short XIV Short VXX
This pair is short both products. The trade is profitable when neither product rises that much from the purchase date. The return profile is inverse to the long/long pair. This pair only does well when a short VXX position outperforms a long XIV position over a specified period.
Below is a chart of returns for this pair. Because of the nature of short positions, it’s possible to lose more than 100% on a trade. Upside returns are also limited due to the decreasing leverage a short position provides as a shorted product declines in value.
I don’t like this pair very much. It can be profitable but really requires a lot more active management to avoid the issues of varying leverage shown in the chart.
Long XIV Short VXX
This pair is not neutral like the other two. You’re basically shorting volatility in two different ways. This means you better have a system for entering/exiting the trade. When the trade is working well it will outperform the other pairs given its directional bias.
Here is a chart showing past returns for the pair.
The short part of the trade presents the same leverage issues as the short/short pair shown previously. I personally prefer using a simple long XIV position for shorting volatility.
Pair returns compared to equities and bonds
I mentioned earlier that the long/long pair had slightly negative correlation to equities and near zero correlation to bonds. Here I’ve posted a chart comparing the long/long pair to returns of SPY and IEF over 120 day holding periods. There appears to be some nice diversification going on.
I’ve charted below differences in open, high, low, and close values between Yahoo Finance and PI Trading for the SPY ETF between 12/30/02 and 11/9/12 (last date in my PI dataset).
I haven’t seen this kind of comparison done elsewhere (let me know if you have). I’ve done this to illustrate just how different various data sources can be. Enjoy!
(Note: Reader James reminded me of a similar comparison made here – http://www.quantifiedstrategies.com/the-importance-of-good-data-sets/ that compared Yahoo finance to IB. Check it out as well.)
I was surprised how close the opening quotes tended to be between the two datasets. There are a handful of big divergences. There seems to be an even spread between higher and lower values.
When the two data sets diverged here, Yahoo finance almost always had higher highs. I think this is a result of bogus, non-tradeable quotes being recorded by Yahoo.
When the two datasets diverged here, Yahoo Finance almost always had lower lows. Again, I think this a result of bogus quotes recorded by Yahoo.
The close quotes differed more than I was expecting. The differences have been smaller though since 2009ish. As with the open comparison, the distribution of values above/below 0 seems random.
I don’t know whether the PI Trading dataset is superior to other sources for testing. It seems reasonable to me that it is more accurate at least than Yahoo Finance, especially for high and low values.
The daily OHLC data from PI was constructed from minute level data. The dataset is missing a day for 1/30/07. Part of the morning of 1/31/07 is also missing.
When comparing the close, I excluded days where the markets closed early.
Here’s a potentially useful indicator for timing the S&P 500 on a weekly basis. Consider the following two strategies:
1. Hold SPX when VXO rose the previous week, else hold cash.
2. Hold SPX when VXO declined the previous week, else hold cash.
Here’s a chart comparing the two strategies since 1986 (not adjusted for dividends).
Not bad. Risk/reward has historically been better when VXO rose the previous week. I guess this makes sense from a mean reversion standpoint. It seems to me this indicator works best when market volatility is high (e.g. late 90′s/early 00′s and financial crisis-present). The indicator wasn’t as valuable during the early 90′s and 04-07 period.
The strategy experienced a number of big losses in this backtest. This happened when SPX fell sharply several weeks in a row while VXO continued to break out to new highs. A filter could be added to the above strategy to filter out some of the potentially big declines. One effective filter would be to avoid holding SPX when VXO closes the previous week more than 20% above its 5 week moving average. The parameters for the filter seem fairly robust. Setting the % too low will weed out a lot of profitable weeks while setting it too high will fail to avoid many of the worst losses.
The chart below compares two strategies:
1. Hold SPX when VXO rose during the previous week AND VXO closed the previous week less than 20% above its 5 week average, else hold cash.
2. Hold SPX when strategy #1 is not in play, else hold cash.
A number of large losses are filtered out without sacrificing too much performance in other time periods.
Here are some stats for the whole period and for 2009 to present.
All data is from Yahoo Finance. Using VIX would have generated similar, though not quite as good results. You can download an Excel copy of this backtest here: VXO SP500 Weekly Strategy