Category: QUSMA

A Quick Look at IB’s Equity Index CFDs

I recently got a mail from IB touting their new lineup of equity index CFDs. As I trade a lot of equity index ETFs I thought I’d take a look at them, in case I could get away with lower margins and/or commissions. Here’s a quick summary of what they offer:

Pros:

  • Granularity compared to futures, minimum size $1 x index value (for U.S. indices).
  • Reasonable commissions.
  • Low margin requirements compared to ETFs.

Cons:

  • No MOC/LOC orders, or any way to not pay the spread.
  • Local regular trading hours only, sometimes not even that. Can’t trade foreign index CFDs at the end of the US session.
  • Trade in local currency, conversion costs if trading foreign indices.
  • Pretty low size limits for any one order.
  • Interest amounts to an additional cost of ~0.004% per day held.
  • Found fills to be somewhat haphazard, even for small order sizes.

Assuming $0.005 per share in commissions and $0.01 in slippage for ETFs, and $1.64 in commission and 1 tick in slippage for futures, here’s how they stack up against each other:

  S&P 500
  CFD ETF (SPY) Futures (ES)
Market (1 tick slippage) 0.023% 0.011% 0.020%
Limit/On Close (no slippage) N/A 0.004% 0.002%

 

  NASDAQ 100
  CFD ETF (QQQ) Futures (NQ)
Market (1 tick slippage) 0.019% 0.023% 0.012%
Limit/On Close (no slippage) N/A 0.008% 0.003%

The costs are similar for all three instruments if you’re doing market orders, though CFDs can of course get costlier if held for longer periods of time. The main advantage of CFDs is the ability to control size compared to futures which are not particularly granular. For that privilege you give up the flexibility of trading outside RTH, which can be a significant disadvantage if you want to place protective stops, or want to trade foreign indices at the end of the day.

Another alternative, of course, are leveraged ETFs, which tend to offer a lower commission per unit of exposure, but have other costs associated with them: spreads for ETFs such as QLD (2x) and TQQQ (3x) are generally at 2-3 cents, management fees of around 1% p.a. (or about 0.0027% per day), as well as potential rebalancing costs. They also do not offer any advantage in terms of margin.

Read more A Quick Look at IB’s Equity Index CFDs

Hedging VIX ETP Strategies Using SPY

Introduction

A quick intro to VIX ETPs (some are ETFs, others are ETNs)1 before we get to the meat: the VIX itself is not tradable, only futures on the VIX are. These futures do not behave like equity index futures which move in lockstep with the underlying, for a variety of reasons. A way to get exposure to these futures without holding them directly, is by using one or more VIX futures-based ETPs. These come in many varieties (long/short, various target average times to expiration, various levels of leverage).

The problem with them, and the reason they fail so badly at mirroring movements in the VIX, is that they have to constantly roll over their futures holdings to maintain their target average time to expiration. A 1-month long ETP will be selling front month futures and buying 2nd month futures every day, for example. Front month futures are usually priced lower than 2nd month futures, which means that the ETP will be losing value as it makes these trades (it’s selling the cheap futures and buying the expensive ones), and vice versa for short ETPs. This amounts to a transfer of wealth from hedgers to speculators willing to take opposite positions; this transfer can be predicted and exploited.

I’ll be looking at two such VIX futures-based instruments in this post: VIXY (which is long the futures), and XIV (which is short the futures). As you can see in the chart below, while the VIX is nearly unchanged over the period, VIXY has lost over 80% of its value. At the same time, XIV is up 50% (though it did suffer a gigantic drawdown).

prices

There are many different approaches to trading these ETPs (for example Mike Brill uses realized VIX volatility to time his trades). The returns are driven by the complex relationships between the value of the index, the value of the index in relation to its moving average, the value of the futures in relation to the index, and the value of various future maturities in relation to each other. These relationships give rise to many strategies, and I’m going to present two of them below.

I’ll be using different approaches for the long and short sides of the trades. Short based on the ratio between the front and 2nd month contract, and long using the basis. Here are the rules:

Go long XIV at close (“short”) when:

  • 2nd month contract is between 5% and 20% higher than the front month contract.

Go long VIXY at close (“long”) when:

  • Front month future is at least 2.5% below the index.
Finally, if both of the above conditions are triggered, go to cash.

Results

First let’s have a look at how these strategies perform without the hedge. Using data from January 2011 to November 2012, here are the daily return stats for these two approaches individually and when combined:

stats unhedged

Equity curves & drawdowns:

EC-and-DD-unhedged

The biggest issues with VIX ETN strategies are large drawdowns, and large sudden losses when the VIX spikes up (and to a lesser extent when it spikes down; these tend to be less violent though). A spike in implied volatility is almost always caused by large movements in the underlying index, in this case the S&P 500. We can use this relationship in our favor by utilizing SPY as a hedge.

  • When long XIV, short SPY in an equal dollar amount.
  • When long VIXY, go long SPY in an equal dollar amount.

The stats:

stats hedged

And the equity curves & drawdowns:

EC-and-DD-hedged

The results are quite good. The bad news is that we have to give up about 40% of CAGR. On a risk-adjusted basis, however, returns are significantly improved.

  • CAGR / St. Dev. goes from 38.7 to 45.9.
  • CAGR / Max Drawdown goes from 4.5 to 4.9.

All risk measures show significant improvement:

  • The worst day goes from a painful -12% to a manageable -9%.
  • Maximum drawdown goes from -36.5% to -25.7%.
  • Daily standard deviation goes from 4.28% to 2.76%.

Of course, just because risk-adjusted returns are improved does not mean it’s necessarily a good idea. Holding SPY results in both direct costs (commissions, slippage, shorting costs) as well as the opportunity cost of the capital’s next-best use. The improvement may not be enough to justify taking away capital from another system, for example.

Another possibility would be to implement this idea using options, which have the benefit of requiring a small outlay. Especially when holding XIV, SPY puts could be a good idea as both implied volatility and price would move in our direction when the VIX spikes up. However, this must be weighted against theta burn. I don’t have access to a dataset for SPY options to test this out, unfortunately (anyone know where I can get EOD options data that is not absurdly expensive?).

If you want to play around with the data yourself, you can download the spreadsheet here.

Footnotes
  1. If you live in the U.S. there can be important differences in tax treatment depending on which one you trade, so do your research.[]

Read more Hedging VIX ETP Strategies Using SPY

Consecutive Up or Down Days, NASDAQ 100 Edition

Just a short post today. Jack Damn has been tweeting about consecutive up/down days lately, which inspired me to go looking for a potential edge. The NASDAQ 100 has posted 6 consecutive up days as of yesterday’s close. Is this a signal of over-extension? Unfortunately there are very few instances of such a high number of consecutive up days, so it’s impossible to speak with certainty about any of the numbers. Let’s take a look at QQQ returns (including dividends) after X consecutive up or down days:

QQQ Returns

 

There’s no edge on the short side here if you’re looking for a mean reversion trade. Looking out over longer horizons, it seems like many consecutive up days tend to be followed by above-average returns. Another argument in favor of the idea that the bottom of the current pullback has been reached, but nothing really useful in terms of actual trading.

Finally, a look at the probability of positive returns following X consecutive up or down days:

QQQ Probability of positive returns

 

UPDATE: Here’s the spreadsheet.

Read more Consecutive Up or Down Days, NASDAQ 100 Edition

Using Factor Momentum to Optimize GTAA Portfolios

Taking another look at portfolio optimization methods as they apply to relative strength- & momentum-based GTAA portfolios, this time I present a novel method that uses factor momentum in an attempt to tilt the allocation towards the factors behind the momentum, and away from factors that do not have strong momentum. The approach was inspired by a nice little paper by Bhansali et al.: The Risk in Risk Parity: A Factor Based Analysis of Asset Based Risk Parity.

My first idea was something I would have termed “Global Tactical Factor Allocation”: a relative strength & momentum approach based directly on risk factors instead of assets. It failed miserably, but the work showed some interesting alternative paths. One of these was to decompose returns into their principal components (factors) and base a weighting algorithm on factor momentum. Early testing shows promise.

PCA basics

A quick intro to principal component analysis (you can skip to the next section if you’re not interested) before we proceed. PCA is method to linear transform data in a potentially useful way. It re-expresses data such that the principal components are uncorrelated (orthogonal) to each other, and the first component expresses the direction of maximum variance (i.e. it explains the greatest possible part of the total variance of any orthogonal component), and so forth for the 2nd…nth components. It can be used as a method of dimensionality reduction by ignoring the lower-variance components, but that is not relevant to the present analysis1.

 The principal components can be obtained very easily. In MATLAB:

  • Assume r are the de-meaned returns of our assets.
  • [V D] = eig(cov(r)); will give us the eigenvectors (V) and eigenvalues (D) of the covariance matrix of r.
  • The diagonal of D contains the variance of each principal component. To get the % of total variance explained by each component, simply: 100 * flipud(diag(D)) / sum(diag(D)).
  • V contains the linear coefficients of our assets to each component; fliplr(V) to get them in the “right” order.
  • Finally, to find the actual principal components we simply multiply the returns with V: r*V.

Data & Methodology

The assets used are the following:

The data covers the period from January 2002 to October 2012 and includes dividends. Some of the assets do not have data for the entire period; they simply become available when they have 252 days of data. The methodology is essentially the standard relative-strength & momentum GTAA approach:

  • Rebalance every Friday.
  • Rank assets by their 120-day returns and pick the top 5.
  • Discard any assets that had negative returns during the period, even if they are in the top 5.
  • Apply portfolio optimization algorithm.
  • Trade on close.

Commissions are not taken into account (though I acknowledge they are a significant issue due to frequent rebalancing). The algorithms I will be benchmarking against are: equal weights, naïve risk parity (RP), equal risk contribution (ERC), and minimum correlation (MCA). See this post for more on these methods.

A look at the factors

When extracting principal components from asset returns there is typically an a posteriori identification of each component with a risk factor. Looking at stock returns, the first factor is typically identified as the so-called “market” factor. Bhansali et al. identify the two first factors as “growth” and “inflation”. I leave this identification process as homework to the reader.

Using the last 250 days in the data, here is the % of total variance explained by each factor:

factor variance explained

And here are the factor loadings (for the top 3 factors) for each asset:

factor loadings

Factor momentum weighting

The general idea is to decompose the returns of our chosen assets into principal components, identify the factors that have relative strength and absolute momentum, and then tilt the weights towards them and away from the low- and negative-momentum factors. We are left with the non-trivial problem of constructing a portfolio that has exposure to the factor(s) we want, and are neutral to the rest. We will do this by setting target betas for the portfolio and then minimizing the difference between the target and realized betas given a set of weights (using a numerical optimizer).

  • After selecting the assets using the above steps, decompose their returns into their principal components.
  • Rank the factors on their 120-day returns and pick the top 3.
  • Discard any factors that had negative returns during the period, even if they are in the top 3.
  • Discarded factors have a target beta of 0.
  • The other factors have a target beta of 12.

The objective then is to minimize:

minimize this function

where ti is the target portfolio beta to risk factor i, βi is the portfolio beta to risk factor i, and M is the number of risk factors.

Results

Here are the performance metrics of the benchmarks and the factor momentum algorithm:

Performance statistics

The selling point of the factor momentum approach is the consistency it manages to achieve, while also maintaining excellent volatility-adjusted and drawdown-adjusted returns. There are two long periods during which the other optimization methods did quite badly (2008-2009 and from the middle of 2011 to the present); factor momentum just keeps going.

Equity curves

One interesting point is that the factor momentum algorithm tends to allocate to fewer holdings than the other approaches (because all the other algorithms will always have non-zero weights for any assets selected, which is not the case for FM). There may be some low-hanging fruit here in terms of diversification.

Some other potentially interesting ideas for the future: is there any value in the momentum of residuals (in a regression against the factor returns), similar to the Blitz, Huij & Martens approach? An interesting extension would be to loosen the factor-neutral constraint to leave room for other objectives. Finding a smarter way to calculate target betas would also be an interesting and probably fruitful exercise; taking each factor’s volatility and momentum into account is probably the most obvious idea.

Footnotes
  1. Dimensionality reduction can be extremely useful in trading, particularly when dealing with machine learning or simply when there is a need to combine multiple overlapping indicators.[]
  2. This is of course a very primitive approach; each factor has different volatility, so equal betas means unequal risk allocated to each factor.[]

Read more Using Factor Momentum to Optimize GTAA Portfolios

Closing Price in Relation to the Day’s Range, and Equity Index Mean Reversion

UPDATE: read The IBS Effect: Mean Reversion in Equity ETFs instead of this post, it features more recent data and deeper analysis.

The location of the closing price within the day’s range is a surprisingly powerful predictor of next-day returns for equity indices. The closing price in relation to the day’s range (or CRTDR [UPDATE: as reader Jan mentioned in the comments, there is already a name for this: Internal Bar Strength or IBS] if you’re a fan of unpronounceable acronyms) is simply calculated as such:

CRTDR formula

It takes values between 0 and 1 and simply indicates at which point along the day’s range the closing price is located. In this post I will take a look not only at returns forecasting, but also how to use this value in conjunction with other indicators. You may be skeptical about the value of something so extremely simplistic, but I think you’ll be pleasantly surprised.

The basics: QQQ and SPY

First, a quick look at QQQ and SPY next-day returns depending on today’s CRTDR:

SPY CRTDR

QQQ CRTDR

A very promising start. Now the equity curves for each quartile:

spy quartile ECs

QQQ quartile ECs

That’s quite good; consistency through time and across assets is important and we’ve got both in this case. The magnitude of the out-performance of the bottom quartile is very large; I think we can do something useful with it.

There are several potential improvements to this basic approach: using the range of several days instead of only the last one, adjusting for the day’s close-to-close return, and averaging over several days are a few of the more obvious routes to explore. However, for the purposes of this post I will simply continue to use the simplest version.

CRTDR Internationally

A quick look across a larger array of assets, which is always an important test (here I also incorporate a bit of shorting):

All ETF results

Long when CRTDR < 45%, short when CRTDR > 95%. $10k per trade. Including commissions of $0.005 per share, excluding dividends.

One question that comes up when looking at ETFs of foreign indices is about the effect of non-overlapping trading hours. Would we be better off using the ETF trading hours or the local trading hours to determine the range and out predictions? Let’s take a look at the EWU ETF (iShares MSCI United Kingdom Index Fund) vs the FTSE 100 index, with the following strategy:

  • Go long on close if CRTDR < 45%
  • Go short on close if CRTDR > 95%
FTSE vs EWU

FTSE vs EWU CRTDR strategy, 1996-2012. $1m per trade (the number was a technical necessity due to the price of the FTSE 100 index).

Fascinating! This result left me completely stumped. I would love to hear your ideas about this…I have a feeling that there must be some sort of explanation, but I’m afraid I can’t come up with anything realistic.

Trading Signal or Filter?

It should be noted that I don’t actually use the CRTRD as a signal to take trades at all. Given the above results you may find this surprising, but all the positive returns are already captured by other, similar (and better), indicators (especially short-term price-based indicators such as RSI(3)). Instead I use it in reverse: as a filter to exclude potential trades. To demonstrate, let’s have a look at a very simplistic mean reversion system:

  • Buy QQQ at close when RSI(3) < 10
  • Sell QQQ at close when RSI(3) > 50

On average, this will result in a daily return of 0.212%. So we have two approaches in our hands that both have positive expectancy, what happens if we combine them?

  • Go long either on the RSI(3) criteria above OR CRTDR < 50%
QQQ RSI and RSI with CRTDR

RSI(3) and RSI(3) w/ CRTDR strategy applied to QQQ. Commissions not included.

This is a bit surprising: putting together two systems, both of which have positive expectancy, results in significantly lower returns. At this point some may say “there’s no value to be gained here”. But fear not, there are significant returns to be wrung out of the CRTDR! Instead of using it as a signal, what if we use it in reverse as a filter? Let’s investigate further: what happens if we split these days up by CRTDR?

RSI signal returns by CRTDR

Now that’s quite interesting. Combining them has very bad results, but instead we have an excellent method to filter out bad RSI(3) trades. Let’s have a closer look at the interplay between RSI(3) signals and CRTDR:

RSI CRTDR square

Next-day QQQ returns.

And now the equity curves with and without the CRTDR < 50% filter:

QQQ RSI and RSI with CRTDR filter

RSI(3) and RSI(3) w/ CRTDR < 50% filter applied to QQQ. Commissions not included.

That’s pretty good. Consistent performance and out-performance relative to the vanilla RSI(3) strategy. Not only that, but we have filtered out over 35% of trades which not only means far less money spent on commissions, but also frees up capital for other trades.

UPDATE: I neglected to mention that I use Cutler’s RSI and not the “normal” one, the difference being the use of simple moving averages instead of exponential moving averages. I have also uploaded an excel sheet and Multicharts .net signal code that replicate most of the results in the post.

Read more Closing Price in Relation to the Day’s Range, and Equity Index Mean Reversion

Equity Returns Following Extreme VIX and WVF Movements, Part 1

Can extreme changes in implied volatility help predict future returns? And can we use a VIX surrogate as a substitute? First, let’s take a look at the WVF and its relationship to the VIX.

The Williams’ VIX Fix (WVF) is an indicator meant to roughly approximate the VIX. It can be useful in situations where there is no implied volatility index for the instrument we want to trade. The WVF is simply a measure of the distance between today’s close and the 22-day highest close; it is calculated as follows:

WVF Formula

A quick visual comparison between the VIX and WVF:

The WVF and VIX behave similarly during volatility spikes, but the WVF fails to emulate the VIX when it hovers at relatively low values. The correlation coefficient between VIX and WVF returns1 is 0.62, while regressing VIX returns on WVF returns using OLS results in an R2 statistic of 0.38.

We’re not going to be using the level of the VIX and WVF (hardcoding strategies to specific levels of the VIX is generally a terrible idea), so the above chart is somewhat useless for our purposes; we’re going to be looking at the 100-day percentile rank of the daily change. Here is a comparison over a couple of recent months:

Some times they move in lockstep, other times there seems to be almost no relation between them. Still, for such a simple indicator, I would say that the WVF does a fantastic job at keeping up with the VIX.

As you probably know, (implied) volatility is highly mean reverting. Extreme increases in the VIX tend to be followed by decreases. These implied volatility drops also tend to be associated with positive returns for equities. Let’s take a look at simple strategy to illustrate the point:

  • Buy SPY on close if the VIX percentage change today is the highest in 100 days.
  • Sell on the next close.

Here’s the equity curve and stats:

Nothing spectacular, but quite respectable. Somewhat inconsistent at times of low volatility, but over the long term it seems to be reliable. What about the same approach, but using the WVF instead?

The WVF outperforms the VIX! A somewhat surprising result…the equity curves look similar of course, with long periods of stagnation during low volatility times. Over the long term the stats are quite good, but we might be able to do better…

There is surprisingly little overlap between the VIX and WVF approaches. There are 96 signals from VIX movements, and 109 signals from WVF movements; in 48 instances both are triggered. These 48 instances however are particularly interesting. Here’s a quick breakdown of results depending on which signal has been triggered:

performance VIX WVF Both

Now this is remarkable. Despite performing better on its own, when isolated the VIX signal is completely useless. This is actually a very useful finding and extends to other similar situations: extreme volatility alone is not enough for an edge, but if used in combination with price-based signals, it can provide significant returns. I leave further combinations on this theme as an exercise for the reader.

A look at the equity curve of “both”:

both equity curve

Long SPY when VIX % change and WVF change are both the highest of the last 100 days, $100k per trade, 1993-2012, no commissions or dividends.

Now that’s just beautiful. You may say “but 37% over 20 years isn’t very impressive at all!”. And you’re right, it isn’t. But for a system that spends almost 99% of the time in cash, it’s fantastic. Want more trade opportunities? Let’s see what happens if we relax the limits on “extremeness”, from the 99th percentile through to the 75th:

extremeness tests

Net profit increases, but profitability per trade, and most importantly risk-adjusted returns suffer. The maximum drawdown increases at a much faster rate than net profits if we relax the limits. Still, there could be value in using even the 50th percentile not as a signal in itself, but (like the day of the month effects) as a slight long bias.

Finally, what if we vary the VIX and WVF limits independently of each other? Let’s have a cursory look at some charts:

As expected, the profit factor is highest at (0.99, 0.99), while net profits are highest at the opposite corner of (0.75, 0.75). It’s interesting to note however, that drawdown-adjusted returns are roughly the same both along the (0.99, 0.75-0.99) and (0.75-0.99, 0.99) areas; as long as one of the two is at the highest extremes, you can vary the other with little consequence in terms of risk-adjusted returns, while increasing net profits. This is definitely an area deserving of further analysis, but that’s for another post.

That’s it for now; I hope some of these ideas can be useful for you. In part 2 we’ll take a look at how the above concepts can be applied to international markets, where there is no direct relation to the VIX and there are no local implied volatility indices to use.

Footnotes
  1. In order to calculate returns for WVF I re-scaled it so the minimum value is 1 instead of 0, thus eliminating the problem of infinite/undefined results.[]

Read more Equity Returns Following Extreme VIX and WVF Movements, Part 1

S&P 500 Returns Following New Lows (and Highs)

Today the S&P 500 closed at a 20-day low. Is there anything useful we can do with this piece of information? Let’s take a look at the performance of SPY after it closes at a 20-day low:

spy performance after 20 day low

 

Not particularly useful I’m afraid, just random variations around the average. What about other look-back lengths?

spy performance after x day low

 

Now this is more interesting. 60-day lows and up appear to have a bit of an edge, both for the day immediately after the low, as well as the medium term afterwards.

Let’s take a closer look at the returns after a 200-day low, with 95% confidence interval bands around them. Naturally, returns tend to be highly volatile around 200-day lows, which (combined with the small number of observations) means a very wide confidence interval.

spy performance after 200 day low

 

The 200-day low effect also seems to be prevalent in most equity indices, but without the regularity and strength that has been displayed by the S&P 500. Finally, what about new highs?

spy performance after x day high

Nothing to see here, move along! Slight underperformance compared to the average, but nowhere near enough to even consider shorting.

Read more S&P 500 Returns Following New Lows (and Highs)

The Predictive Value of the Number and Magnitude of Recent Up/Down Days: UDIDSRI

Rummaging through my bottomless “TO DO” list, I found this little comment:

# of up/dn days in period, then re-scale that using percentrank….with net % move?

An interesting way to spend Sunday afternoon, and another blog post!

After playing around with the concept for a while, I ended up creating a simple indicator that, as it turns out, is impressively good at picking out bottoms1, and has very strong 1-day and acceptable medium-term predictive power. In an attempt to come up with the most awkward-sounding acronym possible, I decided on the name “Up/Down and Intensity Day Summation Rank Indicator”, or UDIDSRI. Here’s what I did:

The first iteration

I started out with a very simple concept:

  • If the day closes up, movement = 1, otherwise movement = -1.
  • Sum movement over the last 20 days.
  • UDIDSRI is the % rank of today’s sum, compared to the last 50 days of sums.

The case that presents the most interest is when UDIDSRI is equal to zero (i.e. the lowest value in 50 days), and we’ll have a look at how this works further down. I felt that this indicator could be significantly improved by adding a bit of nuance. Not all down days are equal, so I thought it would be a good idea to take into account the magnitude of the moves as well as their direction.

The second iteration

The second version of the algorithm:

  • If the day closes up, movement = 1, otherwise movement = -1.
  • Multiply movement by (1 +abs( return))5
  • Sum the movements for the last 20 days.
  • UDIDSRI is the % rank of today’s sum, compared to the last 50 days of sums.

The choice of the 5th power is completely arbitrary and un-optimized (as are the 20-day summation, and 50-day ranking) and can probably be optimized for better performance.

Here’s a chart comparing the two versions on the last few months of SPY (yellow is 1st iteration, red is 2nd):

UDIDSRI comparison chart

You can clearly see that the 2nd iteration doesn’t like to stay at 0 for so long, and tends to respond a bit faster to movements. As such, the 2nd iteration gives far fewer signals, but they’re of much higher quality. I’ll be using the 2nd version for the rest of this post.

UDIDSRI iteration comparison

Note that this approach is completely useless for going short. The indicator hitting its maximum value provides no edge either for mean reversion or trend following.

A quick test around the globe to make sure I wasn’t curve fitting:

all country ETF statistics

That turned out rather well…

Thus far we have only looked at the short-term performance of UDIDSRI. Let’s see how it does over the medium term after hitting 0:

medium term UDIDSRI performance

There seems to be a period of about 30 trading days after UDIDSRI hits 0, during which you can expect above-average returns. Let’s take a look at a strategy that crudely exploits this:

  • Buy SPY at close if UDIDSRI = 0.
  • Use a 2% trailing stop (close-to-close) to exit.

The trailing stop makes us exit quickly if we haven’t entered at a bottom, but stays with the trend if the entry is good. Here are the stats and equity curve for this strategy applied to SPY, using $100k per trade, without commissions or slippage:

medium term UDIDSRI SPY equity curve

medium term UDIDSRI SPY statistics

Finally here are some trades this strategy would have taken in 2011 and early 2012:

medium term UDIDSRI SPY statistics

The most significant problem with the tight trailing stop is that it exits at pullbacks instead of tops (which is particularly painful during heavy bear markets), so one easy improvement would be to add an indicator for over-extension and use that to time the exit. But I’ll leave that as homework.

All in all I’m quite satisfied with the UDIDSRI. I was really surprised at how it manages to pick bottoms with such accuracy, and I will definitely add it to the repertoire of signals that I use for swing trading.

If you want to play with the UDIDSRI yourself, I have uploaded an excel worksheet as well as the indicator and signal for MultiCharts .NET.

Footnotes
  1. For SPY, UDIDSRI gave signals on both the 2002 and 2009 lowest days[]

Read more The Predictive Value of the Number and Magnitude of Recent Up/Down Days: UDIDSRI

Tuesday’s QQQ Move and Equity Index Mean Reversion Worldwide

Tuesday saw QQQ drop somewhat heavily, and for the third day in a row.  These three drops took us back to mid-August levels, blowing through a ton of support levels… My mean reversion senses are tingling!

QQQ 2012

So, let’s take a look at what happens in these situations by formulating a simple rule to capture them, that will then exit after the mean reversion has (hopefully) happened:

  • If QQQ is down at least 3 days in a row, and it closes below the 10-day intraday low, go long.
  • Close the position one day after QQQ closes above its 5-day SMA.

A simple rule, designed to capture big drops in hope for a bounce. The usual issues associated with catching falling knives come up.

Sometimes it works great…

good trade

April 2012

And others not so much…

giant loss

September 2001

But over time there is remarkable consistency:

Equity curve

Run-up & drawdown, assuming $100k per trade, including $0.005 per contract in commissions

Here are the stats:

stats

Note: dot-com bubble not included in these stats because they would look better than they really are over the long run.

Downside skew is never nice of course, is there something we can do to soften the biggest losses? As it happens in most cases with swing systems, adding a stop loss is generally a bad idea. Indeed adding a simple 3% stop loss would decrease returns, lead to a much more uneven equity curve, and also result in deeper and longer drawdowns. Getting fancier and adding various special rules to the stop (such as a period after getting stopped out during which trading is not allowed) does not significantly improve the results. The solution here is simply proper position sizing so that you can take the losses you have to take and still be comfortable.

Finally, is this just an accidental feature of the NASDAQ 100, or could we use it in other markets as well? Let’s have a look at a broad array of equity index ETFs:

country stats

Trades start at each ETF’s inception; dividends are included, commissions are not.

Well, there you have it…

Disclosure: Net long U.S., U.K., Singaporean equities.

Read more Tuesday’s QQQ Move and Equity Index Mean Reversion Worldwide

Portfolio Optimization Algorithm Showdown: GTAA Edition

I was revisiting the choice of portfolio optimization algorithm for the GTAA portion of my portfolio and thought it was an excellent opportunity for another post. The portfolio usually contains 5 assets (though at times it may choose fewer than 5) picked from a universe of 17 ETFs and mutual funds, which are picked by relative and absolute momentum. The specifics are irrelevant to this post as we’ll be looking exclusively at portfolio optimization techniques applied after the asset selection choices have been made.

Tactical asset allocation portfolios present different challenges from optimizing portfolios of stocks, or permanently diversified portfolios, because the mix of asset classes is extremely important and can vary significantly through time. Especially when using methods that weigh directly on volatility, bonds tend to have very large weights. During the last couple of decades this has been working great due to steadily dropping yields, but it may turn out to be dangerous going forward. I aim to test a wide array of approaches, from the crude equal weights, to the trendy risk parity, and the very fresh minimum correlation algorithm. Standard mean-variance optimization is out of the question because of its many and well-known problems, but mainly because forecasting returns is an exercise in futility.

The algorithms

The only restriction on the weights is no shorting; there are no minimum or maximum values.

  • Equal Weights

Self-explanatory.

  • Risk Parity (RP)

Risk parity (often confused with equal risk contribution) is essentially weighting proportional to the inverse of volatility (as measured by the 120-day standard deviation of returns, in this case). I will be using an unlevered version of the approach. I must admit I am still somewhat skeptical of the value of the risk parity approach for the bond-related reasons mentioned above.

  • Minimum Volatility (MV)

Minimum volatility portfolios take into account the covariance matrix and have weights that minimize the portfolio’s expected volatility. This approach has been quite successful in optimizing equity portfolios, partly because it indirectly exploits the low volatility anomaly. You’ll need a numerical optimization algorithm to solve for the minimum volatility portfolio.

  • MV (with shrinkage)

A note on shrinkage (not that kind of shrinkage!): one issue with algorithms that make use of the covariance matrix is estimation error. The number of covariances that must be estimated grows exponentially with the number of assets in the portfolio, and these covariances are naturally not constant through time. The errors in the estimation of these covariances have negative effects further down the road when we calculate the desired weightings.  A partial solution to this problem is to “shrink” the covariance matrix towards a “target matrix”. For more on the topic of shrinkage, as well as a description of the shrinkage approach I use here, see Honey, I Shrunk the Sample Covariance Matrix by Ledoit & Wolf.

  • Equal Risk Contribution (ERC)

The ERC approach is sort of an advanced version of risk parity that takes into account the covariance matrix of the assets’ returns (here‘s a quick comparison between the two). This difference results in significant complications when it comes to calculating weights, as you need to use a numerical optimization algorithm to minimize

formula

subject to the standard restrictions on the weights, where xis the weight of the ith asset, and (Σx)i denotes the ith row of the vector resulting from the product of Σ (the covariance matrix) and x (the weight vector). To do this I use MATLAB’s fmincon SQP algorithm.

For more on ERC, a good overview is On the Properties of Equally-Weighted Risk Contributions Portfolios by Maillard, et. al.

  • ERC (with shrinkage)

See above.

  • Minimum Correlation Algorithm (MCA)

A new optimization algorithm, developed by David Varadi, Michael Kapler, and Corey Rittenhouse. The main object of the MCA approach is to under-weigh assets with high correlations and vice versa, though it’s a bit more complicated than just weighting by the inverse of assets’ average correlation. If you’re interested in the specifics, check out the paper: The Minimum Correlation Algorithm: A Practical Diversification Tool.

The results

Moving on to the results, it quickly becomes clear that there isn’t much variation between the approaches. Most of the returns and risk management are driven by the asset selection process, leaving little room for the optimization algorithms to improve or screw up the results.

portfolio optimization algorithm stats

Predictably, the “crude” approaches such as equal weights or the inverse of maximum drawdown don’t do all that well. Not terribly by any means, but going up in complexity does seem to have some advantages. What stands out is that the minimum correlation algorithm outperforms the rest in both risk-adjusted return metrics I like to use.

Risk parity, despite its popularity, wallows in mediocrity in this test; its only redeeming feature being a bit of positive skew which is always nice to have.

The minimum volatility weights are an interesting case. They do what is says on the box: minimize volatility. Returns suffer consequently, but are excellent on a volatility-adjusted basis. On the other hand, the performance in terms of maximum drawdown is terrible. Some interesting features to note: the worst loss for the minimum volatility weights is by far the lowest of the pack: the worst day in over 15 years was -2.91%. This is accompanied by the lowest average time to recover from drawdowns, and an obscene (though also rather unimportant) longest winning streak of 22 days.

Finally, equal risk contribution weights almost match the performance of minimum volatility in terms of CAGR / St.Dev. while also giving us a lower drawdown. ERC also comes quite close to MCA; I would say it is the second-best approach on offer here.

A look at the equity curves below shows just how similar most of the allocations are. The results could very well be due to luck and not a superior algorithm.

GTAA portfolio optimization methods equity curves

To investigate further, I have divided the equity curves into three parts: 1996 – 2001, 2002-2007, and 2008-2012. Consistent results across these sub-periods would increase my confidence that the best algorithms actually provide value and weren’t just lucky.

subperiod stats

As expected there is significant variation in results between sub-periods. However, I believe these numbers solidify the value of the minimum correlation approach. If we compare it to its closest rival, ERC, minimum correlation comes out ahead in 2 out of 3 periods in terms of volatility-adjusted returns, and in 3 out of 3 periods in terms of drawdown-adjusted returns.

The main lesson here is that as long as your asset selection process and money/risk management are good, it’s surprisingly tough to seriously screw up the results by using a bad portfolio optimization approach. Nonetheless I was happily surprised to see minimum correlation beat out the other, more traditional, approaches, even though the improvement is marginal.

Read more Portfolio Optimization Algorithm Showdown: GTAA Edition