VIX futures calendar spread strategy: a little data mining

Has anyone noticed a bit more volatility in markets these days?  That SNB shocker was something, indeed – it seems some FX retail brokerage houses have already declared insolvency.  Anyway, the increased volatility has had quite an impact on VIX in the year so far: after starting the year at an elevated, yet respectable 17-ish, the index has climbed to a panic-like 22.5.  For those stats-minded, that latter figure implies a daily move of around 1.4% for the SPX – not unusual recently, but pretty darn high compared to post-2008.

OK, let’s get to work.  The VIX is very elevated, but it can be a mug’s game to short (i.e. the VIX can get smashed a bit like the SNB smashed the Euro/CHF exchange rate yesterday).  Too risky for an outright short.  What to do?? A VIX calendar spread.

Mmm...backwardation.  Source: thinkorswim by TDAmeritrade

Mmm…spot the backwardation. Source: thinkorswim by TDAmeritrade

  • Hypothesis: times of high volatility causes the VIX futures curve to go from contango (e.g. further months more expensive than near months) to backwardation (the opposite).  When the market returns to more normal conditions, the contango will return.
  • Method: when the futures curve goes to backwardation, or very near it, go short a near-month future and hedge by going long a further-dated future.  Take off the trade when contango returns.
  • Which contracts?  Note the curves in the picture.  The red line is today’s VIX futures curve – e.g. flat to backwardated.  The other lines are the month-end VIX futures curves for the past 6 months.  A couple observations:
    • In normal markets, there is a pretty smooth contango.  So the max return for any 1-month calendar spread is about the same going out 6 months.  You could choose, say, months 2/3, 3/4, etc.
    • However: notice how much extra movement occurs in months 1 & 2, say, relative to further months.  So, it’s a risk/return situation: if you want higher risk/return, go for earlier months.  I, being a chicken, will stick with a bit less risk – months 3/4, perhaps.  That means I choose to be short Apr 2015, hedged by long May 2015 futures.
  • A bit of data mining to convince me: I downloaded the month 3 and 4 continuous contracts from Quandl, then did the following rough analysis:
    • Time range: 1 Jan 2008 through yesterday, daily data.
    • Metric: gross profit from Month 3 and 4 calendar spread, assuming a 1-month hold (i.e. mechanically holding the position 1 month).
    • Brief, dirty stats:
      • Unconditional (e.g. all daily observations)
        • Observations = 1740
        • Mean gross return = $0.006/spread
        • Expected return, using uniform probability distribution and decile returns (including min/max) = $0.033/spread
        • Z-test for mean different than 0 = 36.8%.  In sum, I can’t assume the expected return is positive.
      • Conditional (e.g. only enter trade when spread is $0.05 or less)
        • Observations = 454
        • Mean gross return = $0.341/spread
        • Expected return, same method = $0.320/spread
        • Z-test for mean different than 0 = less than 0.01%.  In sum, I can assume a positive return.
  • Summary: I think this strategy will work in the current environment, so I’ve put on the trade in small size to test the waters.  Wish me luck!
Advertisements

A quant’s annoyance…continuous futures contracts

Data work.... ugh.  Source: Google images

Data work…. ugh. Source: Google images

Just a small vent today.  I’m deep in the middle of creating my own series of continuous futures contracts, which is both dull and so very important that there’s nothing for it.  I can understand why pre-made series (at least for intraday granularity) cost a fortune.

For those wondering what I’m talking about: futures contracts, like most derivatives, have a finite lifespan.  If I want to go long the S&P 500, I might buy a March 2015-expiry S&P 500 future.  So far, so good.  The issue comes in backtesting quant strategies: one needs to ‘stitch’ these contracts together to create one series for long-term testing purposes.

But wait.  It’s not quite that simple.  Due to various factors, one frequently comes across big price jumps between 2 futures contracts.  What to do?  Depending on the use-case, there are multiple different adjustments that might be appropriate for creating the series.  The most exotic sounding, to me, is the ‘Panama’ method…which is incidentally about the simplest adjustment out there.

Once I’m through downloading many millions of data rows, then back adjusting the futures contracts, I will finally have a time series with reasonable reliability.  Then I just need to remember to keep up the process as life continues.

Perhaps another reason to leave the futures trading to paid professionals.

Let’s do some data mining – Death Cross revisited

It’s all well and good looking for the Death Cross signal to tell when to be in and out of the markets…but is that just an artefact of the data?  I’m curious…

We established last time that being long when the S&P500 was above its 200 DMA, then selling when the price closed below the same DMA, was a somewhat ‘meh’ strategy: returns were about the same as being long the entire period since 1950, but risk/return was a bit better using the strategy.  Using the joy of AmiBroker, plus the plethora of free data on offer from Google Finance etc., we can get some idea of how robust the Death Cross really is.

Here’s what I’ve done:

  1. Downloaded all historical data for the investable S&P500 ETF – SPY.  This begins Feb 1993, so has a few ups and downs.
  2. Using AmiBroker, I simulated a realistic-ish simple trading strategy:
    1. Be long SPY if (an exponentially-weighted) moving average of the price (MA1) is above another moving average of the price (MA2).  Let’s not assume the shorter moving average needs to be higher than the longer for the time being.  BTW, a moving average of 1 = the current price; thus the Death Cross is equivalent to MA1(1) > MA2(200).
    2. If the first MA crosses below the second MA, exit the market until they reverse.
    3. Assume we check these values at the close of each day, and transact on the next day’s open.  No cheating!
    4. Assume a flat $9 for each trade.  That’s about average these days for US brokers.
  3. Vary the lengths of MA1 and MA2 over the following ranges:
    1. MA1: 1 day through 80 days, incrementing by 1 day
    2. MA2: 2 days through 300 days, incrementing by 2 days
  4. Record the net profit of each run, and place in large PivotTable.
  5. Colour said large PivotTable to create the below piece of abstract art:
The closest I come to art.  Green = relatively better idea than Red.  Sources: AmiBroker and Google Finance.

The closest I come to art. Green = relatively better idea than Red. Sources: AmiBroker and Google Finance.

Lovely.  Each row represents a different MA1 value; each column a different MA2.  The colour scheme helps us see some interesting patterns:

  1. Longer averages = better results.  The Death Cross result is that small blue circle, deep in the lower-value area of the chart.  Why?  By having such a reactive average (i.e. the underlying price), each time the price falls below the 200 DMA there’s a lot of buying and selling.  For example, if you unloaded yesterday due to the DMA being crossed, you might very well be getting back in tomorrow.  That’s 2 transaction fees for not much benefit.
  2. ‘Sweet spot’ = around 50 vs 100 DMA.  Over this time period, the darkest green area is around the MA1 = 50 and MA2 = 100 days.  I guess this is because those runs run away from the 2008 crash well: the 50/100 run exits Nov 2007, then re-enters June 2009.
  3. Still doesn’t beat returns of long-only.  Even the best run has about a 105% total return (excluding dividends) since 1993.  Buy-and-hold SPY returned over 300% (excluding dividends) in the same period.  But the drawdowns are perhaps more palatable – around 18% Max drawdown for the 50/100 run, versus 55% for long-only.

What are the lessons?

  • Trading momentum strategies, like the Death Cross, helps the risk profile of an equity portfolio.  It doesn’t help the return profile, at least since 1993.
  • Data mining is sometimes very dangerous – if using data analysis to come up with a really good-looking, overfit strategy.  I think it can be a helpful tool to see how robust a strategy is – as in, what if I’ve completely misspecified the strategy?  In this case, you can be really loose about the 50/100 parameters and still come out better than the Death Cross.