A Practical Application of Regime Switching Models to Pairs Trading

In the previous post I outlined some of the available techniques used for modeling market states.  The following is an illustration of how these techniques can be applied in practice.    You can download this post in pdf format here.

SSALGOTRADING AD

The chart below shows the daily compounded returns for a single pair in an ETF statistical arbitrage strategy, back-tested over a 1-year period from April 2010 to March 2011.

The idea is to examine the characteristics of the returns process and assess its predictability.

Pairs Trading

The initial impression given by the analytics plots of daily returns, shown in Fig 2 below, is that the process may be somewhat predictable, given what appears to be a significant 1-order lag in the autocorrelation spectrum.  We also see evidence of the
customary non-Gaussian “fat-tailed” distribution in the error process.

Regime Switching

An initial attempt to fit a standard Auto-Regressive Moving Average ARMA(1,0,1) model  yields disappointing results, with an unadjusted  model R-squared of only 7% (see model output in Appendix 1)

However, by fitting a 2-state Markov model we are able to explain as much as 65% in the variation in the returns process (see Appendix II).
The model estimates Markov Transition Probabilities as follows.

P(.|1)       P(.|2)

P(1|.)       0.93920      0.69781

P(2|.)     0.060802      0.30219

In other words, the process spends most of the time in State 1, switching to State 2 around once a month, as illustrated in Fig 3 below.

Markov model
In the first state, the  pairs model produces an expected daily return of around 65bp, with a standard deviation of similar magnitude.  In this state, the process also exhibits very significant auto-regressive and moving average features.

Regime 1:

Intercept                   0.00648     0.0009       7.2          0

AR1                            0.92569    0.01897   48.797        0

MA1                         -0.96264    0.02111   -45.601        0

Error Variance^(1/2)           0.00666     0.0007

In the second state, the pairs model  produces lower average returns, and with much greater variability, while the autoregressive and moving average terms are poorly determined.

Regime 2:

Intercept                    0.03554    0.04778    0.744    0.459

AR1                            0.79349    0.06418   12.364        0

MA1                         -0.76904    0.51601     -1.49   0.139

Error Variance^(1/2)           0.01819     0.0031

CONCLUSION
The analysis in Appendix II suggests that the residual process is stable and Gaussian.  In other words, the two-state Markov model is able to account for the non-Normality of the returns process and extract the salient autoregressive and moving average features in a way that makes economic sense.

How is this information useful?  Potentially in two ways:

(i)     If the market state can be forecast successfully, we can use that information to increase our capital allocation during periods when the process is predicted to be in State 1, and reduce the allocation at times when it is in State 2.

(ii)    By examining the timing of the Markov states and considering different features of the market during the contrasting periods, we might be able to identify additional explanatory factors that could be used to further enhance the trading model.

Markov model

Volatility Trading Styles

The VIX Surge of Feb 2018

Volatility trading has become a popular niche in investing circles over the last several years.  It is easy to understand why:  with yields at record lows it has been challenging to find an alternative to equities that offers a respectable return.  Volatility, however, continues to be volatile (which is a good thing in this context) and the steepness of the volatility curve has offered investors attractive returns by means of the volatility carry trade.  In this type of volatility trading the long end of the vol curve is sold, often using longer dated futures in the CBOE VIX Index, for example.  The idea is that profits are generated as the contract moves towards expiration, “riding down” the volatility curve as it does so.  This is a variant of the ever-popular “riding down the yield curve” strategy, a staple of fixed income traders for many decades.  The only question here is what to use to hedge the short volatility exposure – highly correlated S&P500 futures are a popular choice, but the resulting portfolio is exposed to significant basis risk.  Besides, when the volatility curve flatten and inverts, as it did in spectacular fashion in February, the transition tends to happen very quickly, producing a substantial losses on the portfolio.  These may be temporary, if the volatility spike is small or short-lived, but as traders and investors discovered in the February drama, neither of these two desirable outcomes is guaranteed.  Indeed as I pointed out in an earlier post this turned out to be the largest ever two-day volatility surge in history.  The results for many hedge funds, especially in the quant sector were devastating, with several showing high single digit or double-digit losses for the month.

VIX_Spike_1

 

Over time, investors have become more familiar with the volatility space and have learned to be wary of strategies like volatility carry or option selling, where the returns look superficially attractive, until a market event occurs.  So what alternative approaches are available?

An Aggressive Approach to Volatility Trading

In my blog post Riders on the Storm  I described one such approach:  the Option Trader strategy on our Algo Trading Platform made a massive gain of 27% for the month of February and as a result strategy performance is now running at over 55% for 2018 YTD, while maintaining a Sharpe Ratio of 2.23.

Option Trader

 

The challenge with this style of volatility trading is that it requires a trader (or trading system) with a very strong stomach and an investor astute enough to realize that sizable drawdowns are in a sense “baked in” for this trading strategy and should be expected from time to time.  But traders are often temperamentally unsuited to this style of trading – many react by heading for the hills and liquidating positions at the first sign of trouble; and the great majority of investors are likewise unable to withstand substantial drawdowns, even if the eventual outcome is beneficial.

SSALGOTRADING AD

The Market Timing Approach

So what alternatives are there?  One way of dealing with the problem of volatility spikes is simply to try to avoid them.  That means developing a strategy logic that step aside altogether when there is a serious risk of an impending volatility surge.  Market timing is easy to describe, but very hard to implement successfully in practice.  The VIX Swing Trader strategy on the Systematic Algotrading platform attempts to do just that, only trading when it judges it safe to do so. So, for example, it completely side-stepped the volatility debacle in August 2015, ending the month up +0.74%.  The strategy managed to do the same in February this year, finishing ahead +1.90%, a pretty creditable performance given how volatility funds performed in general.  One helpful characteristic of the strategy is that it trades the less-volatile mid-section of the volatility curve, in the form of the VelocityShares Daily Inverse VIX MT ETN (ZIV).  This ensures that the P&L swings are much less dramatic than for strategies exposed to the front end of the curve, as most volatility strategies are.

VIX Swing Trader1 VIX Swing Trader2

A potential weakness of the strategy is that it will often miss great profit opportunities altogether, since its primary focus is to keep investors out of trouble. Allied to this, the system may trade only a handful of times each month.  Indeed, if you look at the track record above you find find months in which the strategy made no trades at all. From experience, investors are almost as bad at sitting on their hands as they are at taking losses:  patience is not a highly regarded virtue in the investing community these days.  But if you are a cautious, patient investor looking for a source of uncorrelated alpha, this strategy may be a good choice. On the other hand, if you are looking for high returns and are willing to take the associated risks, there are choices better suited to your goals.

The Hedging Approach to Volatility Trading

A “middle ground” is taken in our Hedged Volatility strategy. Like the VIX Swing Trader this strategy trades VIX ETFs/ETNs, but it does so across the maturity table. What distinguishes this strategy from the others is its use of long call options in volatility products like the iPath S&P 500 VIX ST Futures ETN (VXX) to hedge the short volatility exposure in other ETFs in the portfolio.  This enables the strategy to trade much more frequently, across a wider range of ETF products and maturities, with the security of knowing that the tail risk in the portfolio is protected.  Consequently, since live trading began in 2016, the strategy has chalked up returns of over 53% per year, with a Sharpe Ratio of 2 and Sortino Ratio above 3.  Don’t be confused by the low % of trades that are profitable:  the great majority of these loss-making “trades” are in fact hedges, which one would expect to be losers, as most long options trades are.  What matters is the overall performance of the strategy.

Hedged Volatility

All of these strategies are available on our Systematic Algotrading Platform, which offers investors the opportunity to trade the strategies in their own brokerage account for a monthly subscription fee.

The Multi-Strategy Approach

The approach taken by the Systematic Volatility Strategy in our Systematic Strategies hedge fund again seeks to steer a middle course between risk and return.  It does so by using a meta-strategy approach that dynamically adjusts the style of strategy deployed as market conditions change.  Rather than using options (the strategy’s mandate includes only ETFs) the strategy uses leveraged ETFs to provide tail risk protection in the portfolio. The strategy has produced an average annual compound return of 38.54% since live trading began in 2015, with a Sharpe Ratio of 3.15:

Systematic Volatility Strategy 1 Page Tear Sheet June 2018

 

A more detailed explanation of how leveraged ETFs can be used in volatility trading strategies is given in an earlier post:

http://jonathankinlay.com/2015/05/investing-leveraged-etfs-theory-practice/

 

Conclusion:  Choosing the Investment Style that’s Right for You

There are different styles of volatility trading and the investor should consider carefully which best suits his own investment temperament.  For the “high risk” investor seeking the greatest profit the Option Trader strategy in an excellent choice, producing returns of +176% per year since live trading began in 2016.   At the other end of the spectrum, the VIX Swing trader is suitable for an investor with a cautious trading style, who is willing to wait for the right opportunities, i.e. ones that are most likely to be profitable.  For investors seeking to capitalize on opportunities in the volatility space, but who are concerned about the tail risk arising from major market corrections, the Hedge Volatility strategy offers a better choice.  Finally, for investors able to invest $250,000 or more, a hedge fund investment in our Systematic Volatility strategy offers the highest risk-adjusted rate of return.

Momentum Strategies

A few weeks ago I wrote an extensive post on a simple momentum strategy in E-Mini Futures. The basic idea is to buy the S&P500 E-Mini futures when the contract makes a new intraday high. This is subject to the qualification that the Internal Bar Strength fall below a selected threshold level. In order words, after a period of short-term weakness – indicated by the low reading of the Internal Bar Strength – we buy when the futures recover to make a new intraday high, suggesting continued forward momentum.

IBS is quite a useful trading indicator, which you can learn more about in the blog post:

A characteristic of momentum strategies is that they can often be applied successfully across several markets, usually with simple tweaks to the strategy parameters. As a case in point, take our Tech Momentum strategy, listed on the Systematic Strategies Algotrading platform which you can find out more about here:

This swing trading strategy applies similar momentum concepts to exploits long and short momentum effects in technology sector ETFs, focusing on the PROSHARES ULTRAPRO QQQ (TQQQ) and PROSHARES ULTRAPRO SHORT QQQ (SQQQ). Does it work? The results speak for themselves:

In four years of live trading the strategy has produced a compound annual return of 48.9%, with a Sharpe Ratio of 1.78 and Sortino Ratio of 2.98. 2018 is proving to be a banner year for the strategy, which is up by more than 48% YTD.

A very attractive feature of this momentum approach is that it is almost completely uncorrelated with the market and with a beta of just over 1 is hardly more risky than the market portfolio.

You can find out more about the Tech Momentum and other momentum strategies and how to trade them live in your own account on our Strategy Leaderboard:

A Tactical Equity Strategy

We have created a long-only equity strategy that aims to beat the S&P 500 total return benchmark by using tactical allocation algorithms to invest in equity ETFs.   One of the principal goals of the strategy is to protect investors’ capital during periods of severe market stress such as in the downturns of 2000 and 2008.  The strategy times the allocation of capital to equity ETFs or short-duration Treasury securities when investment opportunities are limited.

SSALGOTRADING AD

Systematic Strategies is a hedge fund rather than an RIA, so we have no plans to offer the product to the public.  However, we are currently holding exploratory discussions with Registered Investment Advisors about how the strategy might be made available to their clients.

For more background, see this post on Seeking Alpha: http://tiny.cc/ba3kny

 

 

Slide1

 

Slide2

Capitalizing on the Coming Market Crash

Long-Only Equity Investors

Recently I have been discussing possible areas of collaboration with an RIA contact on LinkedIn, who also happens to be very familiar with the hedge fund world.  He outlined the case of a high net worth investor in equities (long only), who wanted to remain invested, but was becoming increasingly concerned about the prospects for a significant market downturn, or even a market crash, similar to those of 2000 or 2008.

I am guessing he is not alone: hardly a day goes by without the publication of yet another article sounding a warning about stretched equity valuations and the dangerously elevated level of the market.

The question put to me was, what could be done to reduce the risk in the investor’s portfolio?

Typically, conservative investors would have simply moved more of their investment portfolio into fixed income securities, but with yields at such low levels this is hardly an attractive option today. Besides, many see the bond market as representing an even more extreme bubble than equities currently.

SSALGOTRADING AD

Hedging Strategies

The problem with traditional hedging mechanisms such as put options, for example, is that they are relatively expensive and can easily reduce annual returns from the overall portfolio by several hundred basis points.  Even at current low level of volatility the performance drag is noticeable, since the potential upside in the equity portfolio is also lower than it has been for some time.  A further consideration is that many investors are not mandated – or are simply reluctant – to move beyond traditional equity investing into complex ETF products or derivatives.

An equity long/short hedge fund product is one possible solution, but many equity investors are reluctant to consider shorting stocks under any circumstances, even for hedging purposes. And while a short hedge may provide some downside protection it is unlikely to fully safeguard the investor in a crash scenario.  Furthermore, the cost of a hedge fund investment is typically greater than for a long-only product, entailing the payment of a performance fee in addition to management fees that are often higher than for standard investment products.

The Ideal Investment Strategy

Given this background, we can say that the ideal investment strategy is one that:

  • Invests long-only in equities
  • Is inexpensive to implement (reasonable management fees; no performance fees)
  • Does not require shorting stocks, or expensive hedging mechanisms such as options
  • Makes acceptable returns during both bull and bear markets
  • Is likely to produce positive returns in a market crash scenario

A typical buy-and-hold approach is unlikely to meet only the first three requirements, although an argument could be made that a judicious choice of defensive stocks might enable the investment portfolio to generate returns at an “acceptable” level during a downturn (without being prescriptive as to the precise meaning of that term may be).  But no buy-and-hold strategy could ever be expected to prosper during times of severe market stress.  A more sophisticated approach is required.

Market Timing

Market timing is regarded as a “holy grail” by some quantitative strategists.  The idea, simply, is to increase or reduce risk exposure according to the prospects for the overall market.  For a very long time the concept has been dismissed as impossible, by definition, given that markets are mostly efficient.  But analysts have persisted in the attempt to develop market timing techniques, motivated by the enormous benefits that a viable market timing strategy would bring.  And gradually, over time, evidence has accumulated that the market can be timed successfully and profitably.  The rate of progress has accelerated in the last decade by the considerable advances in computing power and the development of machine learning algorithms and application of artificial intelligence to investment finance.

I have written several articles on the subject of market timing that the reader might be interested to review (see below).  In this article, however, I want to focus firstly on the work on another investment strategist, Blair Hull.

http://jonathankinlay.com/2014/07/how-to-bulletproof-your-portfolio/

 

http://jonathankinlay.com/2014/07/enhancing-mutual-fund-returns-with-market-timing/

The Hull Tactical Fund

Blair Hull rose to prominence in the 1980’s and 1990’s as the founder of the highly successful quantitative option market making firm, the Hull Trading Company which at one time moved nearly a quarter of the entire daily market volume on some markets, and executed over 7% of the index options traded in the US. The firm was sold to Goldman Sachs at the peak of the equity market in 1999, for a staggering $531 million.

Blair used the capital to establish the Hull family office, Hull Investments, and in 2013 founded an RIA, Hull Tactical Asset Allocation LLC.   The firm’s investment thesis is firmly grounded in the theory of market timing, as described in the paper “A Practitioner’s Defense of Return Predictability”,  authored by Blair Hull and Xiao Qiao, in which the issues and opportunities of market timing and return predictability are explored.

In 2015 the firm launched The Hull Tactical Fund (NYSE Arca: HTUS), an actively managed ETF that uses quantitative trading model to take long and short positions in ETFs that seek to track the performance of the S&P 500, as well as leveraged ETFs or inverse ETFs that seek to deliver multiples, or the inverse, of the performance of the S&P 500.  The goal to achieve long-term growth from investments in the U.S. equity and Treasury markets, independent of market direction.

How well has the Hull Tactical strategy performed? Since the fund takes the form of an ETF its performance is a matter in the public domain and is published on the firm’s web site.  I reproduce the results here, which compare the performance of the HTUS ETF relative to the SPDR S&P 500 ETF (NYSE Arca: SPY):

 

Hull1

 

Hull3

 

Although the HTUS ETF has underperformed the benchmark SPY ETF since launching in 2015, it has produced a higher rate of return on a risk-adjusted basis, with a Sharpe ratio of 1.17 vs only 0.77 for SPY, as well as a lower drawdown (-3.94% vs. -13.01%).  This means that for the same “risk budget” as required to buy and hold SPY, (i.e. an annual volatility of 13.23%), the investor could have achieved a total return of around 36% by using margin funds to leverage his investment in HTUS by a factor of 2.8x.

How does the Hull Tactical team achieve these results?  While the detailed specifics are proprietary, we know from the background description that market timing (and machine learning concepts) are central to the strategy and this is confirmed by the dynamic level of the fund’s equity exposure over time:


Hull2

 

A Long-Only, Crash-Resistant Equity Strategy

A couple of years ago I and my colleagues carried out an investigation of long-only equity strategies as part of a research project.  Our primary focus was on index replication, but in the course of our research we came up with a methodology for developing long-only strategies that are highly crash-resistant.

The performance of our Long-Only Market Timing strategy is summarized below and compared with the performance of the HTUS ETF and benchmark SPY ETF (all results are net of fees).  Over the period from inception of the HTUS ETF, our LOMT strategy produced a higher total return than HTUS (22.43% vs. 13.17%), higher CAGR (10.07% vs. 6.04%), higher risk adjusted returns (Sharpe Ratio 1.34 vs 1.21) and larger annual alpha (6.20% vs 4.25%).  In broad terms, over this period the LOMT strategy produced approximately the same overall return as the benchmark SPY ETF, but with a little over half the annual volatility.

 

Fig4

 

Fig5

Application of Artificial Intelligence to Market Timing

Like the HTUS ETF, our LOMT strategy operates with very low fees, comparable to an ETF product rather than a hedge fund (1% management fee, no performance fees).  Again, like the HTUS ETF our LOMT products makes no use of leverage.  However, unlike HTUS it avoids complicated (and expensive) inverse or leveraged ETF products and instead invests only in two assets – the SPY ETF and 91-day US Treasury Bills.  In other words, the LOMT strategy is a pure market timing strategy, moving capital between the SPY ETF and Treasury Bills depending on its forecast of future market performance.  These forecasts are derived from machine learning algorithms that are specifically tuned to minimize the downside risk in the investment portfolio.  This not only makes strategy returns less volatile, but also ensures that the strategy is very robust to market downturns.

In fact, even better than that,  not only does the LOMT strategy tend to avoid large losses during periods of market stress, it is capable of capitalizing on the opportunities that more volatile market conditions offer.  Looking at the compounded returns (net of fees) over the period from 1994 (the inception of the SPY ETF) we see that the LOMT strategy produces almost double the total profit of the SPY ETF, despite several years in which it underperforms the benchmark.  The reason is clear from the charts:  during the periods 2000-2002 and again in 2008, when the market crashed and returns in the SPY ETF were substantially negative, the LOMT strategy managed to produce positive returns.  In fact, the banking crisis of 2008 provided an exceptional opportunity for the LOMT strategy, which in that year managed to produce a return nearing +40% at a time when the SPY ETF fell by almost the same amount!

 

Fig6

 

Fig7

 

Long Volatility Strategies

I recall having a conversation with Nassim Taleb, of Black Swan fame, about his Empirica fund around the time of its launch in the early 2000’s.  He explained that his analysis had shown that volatility was often underpriced due to an under-estimation of tail risk, which the fund would seek to exploit by purchasing cheap out-of-the-money options.  My response was that this struck me a great idea for an insurance product, but not a hedge fund – his investors, I explained, were going to hate seeing month after month of negative returns and would flee the fund.  By the time the big event occurred there wouldn’t be sufficient AUM remaining to make up the shortfall.  And so it proved.

A similar problem arises from most long-volatility strategies, whether constructed using options, futures or volatility ETFs:  the combination of premium decay and/or negative carry typically produces continuing losses that are very difficult for the investor to endure.

Conclusion

What investors have been seeking is a strategy that can yield positive returns during normal market conditions while at the same time offering protection against the kind of market gyrations that typically decimate several years of returns from investment portfolios, such as we saw after the market crashes in 2000 and 2008.  With the new breed of long-only strategies now being developed using machine learning algorithms, it appears that investors finally have an opportunity to get what they always wanted, at a reasonable price.

And just in time, if the prognostications of the doom-mongers turn out to be correct.

Contact Hull Tactical

Contact Systematic Strategies

Volatility ETF Trader – June 2017: +15.3%

The Volatility ETF Trader product is an algorithmic strategy that trades several VIX ETFs using statistical and machine learning algorithms.

We offer a version of the strategy on the Collective 2 site (see here for details) that the user can subscribe to for a very modest fee of only $149 per month.

The risk-adjusted performance of the Collective 2 version of the strategy is unlikely to prove as good as the product we offer in our Systematic Strategies Fund, which trades a much wider range of algorithmic strategies.  There are other important differences too:  the Fund’s Systematic Volatility Strategy makes no use of leverage and only trades intra-day, exiting all positions by market close.  So it has a more conservative risk profile, suitable for longer term investment.

The Volatility ETF Trader on Collective 2, on the other hand, is a highly leveraged, tactical strategy that trades positions overnight and holds them for periods of several days .  As a consequence, the Collective 2 strategy is far more risky and is likely to experience significant drawdowns.    Those caveats aside, the strategy returns have been outstanding:  +48.9% for 2017 YTD and a total of +107.8% from inception in July 2016.

You can find full details of the strategy, including a listing of all of the trades, on the Collective 2 site.

Subscribers can sign up for a free, seven day trial and thereafter they can choose to trade the strategy automatically in their own brokerage account.

 

VIX ETF Strategy June 2017

Machine Learning Trading Systems

The SPDR S&P 500 ETF (SPY) is one of the widely traded ETF products on the market, with around $200Bn in assets and average turnover of just under 200M shares daily.  So the likelihood of being able to develop a money-making trading system using publicly available information might appear to be slim-to-none. So, to give ourselves a fighting chance, we will focus on an attempt to predict the overnight movement in SPY, using data from the prior day’s session.

In addition to the open/high/low and close prices of the preceding day session, we have selected a number of other plausible variables to build out the feature vector we are going to use in our machine learning model:

  • The daily volume
  • The previous day’s closing price
  • The 200-day, 50-day and 10-day moving averages of the closing price
  • The 252-day high and low prices of the SPY series

We will attempt to build a model that forecasts the overnight return in the ETF, i.e.  [O(t+1)-C(t)] / C(t)

SSALGOTRADING AD

In this exercise we use daily data from the beginning of the SPY series up until the end of 2014 to build the model, which we will then test on out-of-sample data running from Jan 2015-Aug 2016.  In a high frequency context a considerable amount of time would be spent evaluating, cleaning and normalizing the data.  Here we face far fewer problems of that kind.  Typically one would standardized the input data to equalize the influence of variables that may be measured on scales of very different orders of magnitude.  But in this example all of the input variables, with the exception of volume, are measured on the same scale and so standardization is arguably unnecessary.

First, the in-sample data is loaded and used to create a training set of rules that map the feature vector to the variable of interest, the overnight return:

 

fig1

 

In Mathematica 10 Wolfram introduced a suite of machine learning algorithms that include regression, nearest neighbor, neural networks and random forests, together with functionality to evaluate and select the best performing machine learning technique.  These facilities make it very straightfoward to create a classifier or prediction model using machine learning algorithms, such as this handwriting recognition example:

handwriting

We create a predictive model on the SPY trainingset, allowing Mathematica to pick the best machine learning algorithm:

fig3

There are a number of options for the Predict function that can be used to control the feature selection, algorithm type, performance type and goal, rather than simply accepting the defaults, as we have done here:

fig4

Having built our machine learning model, we load the out-of-sample data from Jan 2015 to Aug 2016, and create a test set:

fig5

 

We next create a PredictionMeasurement object,  using the Nearest Neighbor model , that can be used for further analysis:

 

fig6

fig7

fig8

 

There isn’t much dispersion in the model forecasts, which all have positive value.  A common technique in such cases is to subtract the mean from each of the forecasts (and we may also standardize them by dividing by the standard deviation).

The scatterplot of actual vs. forecast overnight returns in SPY now looks like this:

scatterplot

 

There’s still an obvious lack of dispersion in the forecast values, compared to the actual overnight returns, which we could rectify by standardization. In any event, there appears to be a small, nonlinear relationship between forecast and actual values, which holds out some hope that the model may yet prove useful.

From Forecasting to Trading

There are various methods of deploying a forecasting model in the context of creating a trading system.  The simplest route, which we  will take here, is to apply a threshold gate and convert the filtered forecasts directly into a trading signal. But other approaches are possible, for example:

  • Combining the forecasts from multiple models to create a prediction ensemble
  • Using the forecasts as inputs to a genetic programming model
  • Feeding the forecasts into the input layer of  a neural network model designed specifically to generate trading signals, rather than forecasts

In this example we will create a trading model by applying a simple filter to the forecasts, picking out only those values that exceed a specified threshold. This is a standard trick used to isolate the signal in the model from the background noise.  We will accept only the positive signals that exceed the threshold level, creating a long-only trading system.  i.e. we ignore forecasts that fall below the threshold level.  We buy SPY at the close when the forecast exceeds the threshold and exit any long position at the next day’s open.  This strategy produces the following pro-forma results:

 

Perf table

 

equity curve

 

Conclusion

The system has some quite attractive features, including a win rate of over 66%  and a CAGR of over 10% for the out-of-sample period.

Obviously, this is a very basic illustration: we would want to factor in trading commissions, and the slippage incurred entering and exiting positions in the post- and pre-market periods, which will negatively impact performance, of course.  On the other hand, we have barely begun to scratch the surface in terms of the variables that could be considered for inclusion in the feature vector, and which may increase the explanatory power of the model.

In other words, in reality, this is only the beginning of a lengthy and arduous research process. Nonetheless, this simple example should be enough to give the reader a taste of what’s involved in building a predictive trading model using machine learning algorithms.

 

 

The Internal Bar Strength Indicator

Internal Bar Strength (IBS) is an idea that has been around for some time.  IBS is based on the position of the day’s close in relation to the day’s range: it takes a value of 0 if the closing price is the lowest price of the day, and 1 if the closing price is the highest price of the day.

More formally:

IBS  =  (Close – Low) / (High – Low)

The IBS effect may be related to intraday over-reaction to news or market movements, which are then ”corrected” the next day.  It serves as a measure of the tendency of a price series to mean-revert over daily horizons.  I use the term “daily” advisedly: so far as I am aware, there has been no research (including my own) demonstrating the existence of an IBS effect at time horizons shorter, or longer, than one day.  Indeed, there has been very little in the way of academic research into the concept of any kind, which is strange considering how compelling are the results it is capable of producing.  Practitioners have been happy enough with that state of affairs, content to deploy this neglected indicator in their trading strategies, where it has often proved to be extremely useful (we use IBS in one of our volatility strategies). Since 2013, however, the cat has been let out of the bag, thanks to an excellent research paper by Alexander Pagonidis, who writes an interesting quantitative finance blog.

The essence of the idea is that stocks that close in the lowest part of the daily range, with an IBS of below, say, 0.2, will tend to rally the next day, while stocks that close in the highest quintile will often decline in value in the following session.  In his paper “The IBS Effect: Mean Reversion in Equity ETFs” (2013), Pagonidis researches the IBS effect in equity index ETFs in the US and several international markets.  He confirms that low IBS values in these assets are associated with high returns in the following day session, while high IBS values are associated with low returns. Average returns when IBS is below 0.20 are .35% ,while average returns when IBS is above 0.80 are -0.13%. According to his research, this effect has been present in equity ETFs since the early 90s and has been highly consistent through time.

SSALGOTRADING AD

IBS Strategy Performance

To give the reader some idea of the potential of the IBS effect, I have reproduced below equity curves for the IBS strategy for the SPDR S&P 500 ETF Trust (SPY) and iShares MSCI Singapore ETF (EWS) index ETFs over the period from 1999 to 2016.  The strategy buys at the close when IBS is below 0.2, and sells at the close when IBS exceeds 0.8, liquidating the position at the following market close. Strategy CAGR over the period has been of the order of 13% for SPY and as high as 40% for EWS, ignoring transaction costs.

IBS Strategy Chart SPY EWS

 

Note that in both cases strategy returns for SPY and EWS have diminished in recent years, turning negative in 2015 and 2016 YTD and this is true for ETFs in general.  It remains to be seen whether this deterioration in strategy performance is temporary or permanent.  There are some indications that the latter holds true, but the evidence is not quite definitive.  For example, the chart below shows daily equity curve for the SPY IBS strategy, with 95% confidence intervals for the latest 100 trades (up to the end of May 2016), constructed using Monte-Carlo bootstrap.  The equity curve appears to have penetrated the lower bound, indicating a statistically significant deterioration in the performance of the IBS strategy for SPY over the last year or so (EWS is similar).  That said, the equity curve does fall inside the boundaries of the 99% confidence interval, so those looking for greater certainty about the possible breakdown of the effect will need to wait a little longer for confirmation.

 

SPY IBS MSA

 

Whatever the outcome may be for SPY and other ETFs going forward, it is certainly true that IBS effects persist strongly for some individual equities, Exxon-Mobil Corp. (XOM) being a case in point (see below).  It’s worth taking note of the exceptional performance of the XOM IBS strategy during the latter quarter of 2008.  I will have much more to say on the application of the IBS indicator for individual equities in a future blog post.

 

XOM IBS Strategy

 

The Role of Range, Volume, Bull/Bear Markets, Volatility and Seasonality

Pagonidis goes on to detail several further important findings in relation to IBS.  It is clear from his research that high volatility is related to increased predictability of returns and a more powerful IBS effect, in particular the high IBS-negative return aspect.  As might be expected, the effect is also larger after days with high range, both for high and low IBS extremes.

Volume turns out to be especially important for  U.S. index ETFs:  in fact, the IBS effect only appears to work on high-volume days.

Pagonidis also separates the data into bull and bear market environments, based on whether 200-day returns are positive or not.  The size of the effect is roughly similar in each environment (slightly larger in bear markets), but it is greater in the direction of the overall trend: high IBS readings are followed by larger negative returns during bear markets, and vice versa.

Day of Week Effect

The IBS effect is also strongly seasonal, having the greatest impact on returns from Monday’s close to Tuesday’s close, as illustrated for the SPY ETF in the chart below.  This accounts for the phenomenon known popularly as “Turnaround Tuesday”, i.e. the tendency for the market to recover strongly from losses on a Monday.  The day-of-week effect is weakest for Fridays.

 

SPY DOW

 

The mean of the returns distribution is not the only aspect that IBS can predict. Skewness also varies significantly between IBS buckets, with low IBS readings being followed by highly skewed returns, and vice versa. Close-to-close returns after a bottom-bucket IBS day have average skewness of 0.65 across Equity Index ETF products, while top-bucket IBS days are followed by returns with skewness of 0.03. This finding has very useful risk management applications for investors concerned with tail risk.

IBS as a Filter for a Swing Trading Strategy in QQQ

The returns to an IBS-only strategy are both statistically and economically significant. However, commissions will greatly decrease the returns and increase the maximum drawdowns, however, making such an approach challenging in the real world. One alternative is to combine the IBS effect with mean reversion on longer timescales and only take trades when they align.

Pagonidis offers a simple demonstration using the Cutler’s RSI indicator that shows how the IBS effect can be used to boost returns of a swing trading strategy while significantly decreasing the number of trades needed.

Cutler’s RSI at time t is calculated as follows:

 

RSI

 

Pagonidis tests a simple, long-only strategy that trades the PowerShares QQQ Trust, Series 1 (QQQ) ETF using the Cutler’s RSI(3) indicator:

• Go long at the close if RSI(3) < 10

• Maintain the position while RSI(3) ≤ 40

 filter these returns by adding an additional rule based on the value of IBS:

• Enter or maintain long position only if IBS ≤ 0.5

Pangonis claims that the strategy produces rather promising results that “easily beats commissions”;  however, my own rendition of the strategy, assuming commissions of $0.005 per share and slippage of a further $0.02 per share produces results that are distinctly less encouraging:

EC0

 

Pef0

Strategy Code

For those interested, the code is as follows:

Inputs:
RSILen(3),
RSI_Entry(10),
RSI_Exit(40),
IBS_Threshold(0.5),
Initial_Capital(100000);
Vars:
nShares(100),
RSIval(0),
IBS(0);
RSIval=RSI(C,RSILen);
IBS = (C-L)/(H-L);

nShares = Round(Initial_Capital / Close,0);

If Marketposition = 0 and RSIval > RSI_Entry and IBS < IBS_Threshold then begin
Buy nShares contracts next bar at market;
end;
If Marketposition > 0 and ((RSIval > RSI_Exit) or (IBS_Threshold > IBS_Threshold)) then begin
Sell next bar at market;
end;

Strategy Optimization and Robustness Testing

One can further improve performance by optimizing the trading system parameters, using Tradestation’s excellent Walk Forward Optimization (WFO) module.  This allows us to examine the effect of re-calibrating the strategy parameters are regular intervals, testing the optimized model on out-of-sample data sets of various sizes.  WFO can be used, not only optimize a strategy, but also to examine the sensitivity of its performance to changes in the levels of key parameters.  For example, in the case of the QQQ swing trading strategy, we find that profitability increases monotonically with the length of the RSI indicator, and this effect is especially marked when an IBS threshold level of 0.2 is used:

Sensitivity

 

Likewise we can test the consistency of the day-of-the-week effect over several OS data sets of  varying size and these tests are consistent with the pattern seen earlier for the IBS indicator, confirming its role as a filter rule in enhancing system profitability:

Distribution Analysis

 

A model that is regularly re-calibrated using WFO is subjected to a series of tests designed to ensure its robustness and consistency in live trading.   The tests include the following:

 

WFO

 

In order to achieve an overall pass rating, the system is required to pass all five tests of its out-of-sample performance, from which Tradestation deems it likely that the system will continue to perform well in live trading.  The results from this procedure appear much more promising than the strategy in its original form, as can be seen from the performance table and equity curve chart shown below.

EC1

Perf1

 

However, these results include both in-sample and out-of-sample periods.  An examination of the results from the WFO indicate that the overall efficiency of the strategy is around 55%, meaning that the P&L produced by the system in out-of-sample periods amounts to a little over one half of the rate of profit produced during in-sample periods.  Going forward, therefore, we might expect the performance of the system in live trading to be only around half as good as shown here.  While this is still superior to the original system, it may not be considered good enough.  Nonetheless, for the purpose of illustrating the benefits of the IBS indicator as a trade filter, it makes the point.

Another interesting example of an IBS-based trading strategy in the QQQ and SPY ETFs can be found in the following blog post.

Conclusion

Internal Bar Strength is a powerful mean-reversion indicator for equity products traded at daily frequencies, with a consistent effect that has continued from the 1990s through to the current decade. IBS can be used on its own in mean-reversion strategies that have worked well for both US equities and US and International equity index ETFs, or used as a trade filter when combined with other alpha signals.

While there is evidence of a weakening of the IBS effect since around 2013 this is not yet confirmed statistically (at the 99% confidence level) and may simply be the result of normal statistical variation in its efficacy.

 

 

ETFs vs. Hedge Funds – Why Not Combine Both?

Grace Kim, Brand Director at DarcMatter, does a good job of setting out the pros and cons of ETFs vs hedge funds for the family office investor in her LinkedIn post.

She points out that ETFs now offer as much liquidity as hedge funds, both now having around $2.96 trillion in assets.  So, too, are her points well made about the low cost, diversification and ease of investing in ETFs compared to hedge funds.

But, of course, the point of ETF investing is to mimic the return in some underlying market – to gain beta exposure, in the jargon – whereas hedge fund investing is all about alpha – the incremental return that is achieved over and above the return attributable to market risk factors.

SSALGOTRADING AD

But should an investor be forced to choose between the advantages of diversification and liquidity of ETFs on the one hand and the (supposedly) higher risk-adjusted returns of hedge funds, on the other?  Why not both?

Diversified Long/Short ETF Strategies

In fact, there is nothing whatever to prevent an investment strategist from constructing a hedge fund strategy using ETFs.  Just as one can enjoy the hedging advantages of a long/short equity hedge fund portfolio, so, too, can one employ the same techniques to construct long/short ETF portfolios.  Compared to a standard equity L/S portfolio, an ETF L/S strategy can offer the added benefit of exposure to (or hedge against) additional risk factors, including currency, commodity or interest rate.

For an example of this approach ETF long/short portfolio construction, see my post on Developing Long/Short ETF Strategies.  As I wrote in that article:

My preference for ETFs is due primarily to the fact that  it is easier to achieve a wide diversification in the portfolio with a more limited number of securities: trading just a handful of ETFs one can easily gain exposure, not only to the US equity market, but also international equity markets, currencies, real estate, metals and commodities.

More Exotic Hedge Fund Strategies with ETFs

But why stop at vanilla long/short strategies?  ETFs are so varied in terms of the underlying index, leverage and directional bias that one can easily construct much more sophisticated strategies capable of tapping the most obscure sources of alpha.

Take our very own Volatility ETF strategy for example.  The strategy constructs hedged positions, not by being long/short, but by being short/short or long/long volatility and inverse volatility products, like SVXY and UVXY, or VXX and XIV.  The strategy combines not only strategic sources of alpha that arise from factors such as convexity in the levered ETF products, but also short term alpha signals arising from temporary misalignments in the relative value of comparable ETF products.  These can be exploited by tactical, daytrading algorithms of a kind more commonly applied in the context of high frequency trading.

For more on this see for example Investing in Levered ETFs – Theory and Practice.

Does the approach work?  On the basis that a picture is worth a thousand words, let me answer that question as follows:

Systematic Strategies Volatility ETF Strategy

Perf Summary Dec 2015

Conclusion

There is no reason why, in considering the menu of ETF and hedge fund strategies, it should be a case of either-or.  Investors can combine the liquidity, cost and diversification advantages of ETFs with the alpha generation capabilities of well-constructed hedge fund strategies.