Quantitative Trading: How to Build Your Own Algorithmic Trading Business (Wiley Trading)
Ernie Chan

Ended: Dec. 23, 2013

One final note: Some may think that there is a tax advantage in joining a proprietary trading firm because any trading loss can be deducted from current income instead of as capital loss. Actually, you can choose to apply for trader tax status even if you have a retail brokerage account so that your trading loss can offset other income, and not just other capital gain. For details on the tax considerations of a trading business, you can visit, for example, www.greencompany.com.
Suppose you plan to trade several strategies, each with their own expected returns and standard deviations. How should you allocate capital among them in an optimal way? Furthermore, what should be the overall leverage (ratio of the size of your portfolio to your account equity)? Dr. Edward Thorp, whom I mentioned in the preface, has written an excellent expository article on this subject in one of his papers (Thorp, 1997),
Still others like to use the discipline of machine learning or artificial intelligence (in particular, techniques such as hidden Markov models, Kalman filter, neural networks, etc.) to discover whether the prices are in a mean-reverting or trending “regime.” I personally have not found such general theories of mean reversion or momentum particularly useful.
Rather, I find it is usually safe to assume that, unless the expected earnings of a company have changed, stock prices will be mean reverting. In fact, financial researchers (Khandani and Lo, 2007) have constructed a very simple short-term mean reversal model that is profitable (before transaction costs) over many years. Of course, whether the mean reversion is strong enough and consistent enough such that we can trade profitably after factoring in transaction costs is another matter, and it is up to you, the trader, to find those special circumstances when it is strong and consistent.
Momentum can be generated by the slow diffusion of information—as more people become aware of certain news, more people decide to buy or sell a stock, thereby driving the price in the same direction. I suggested earlier that stock prices may exhibit momentum when the expected earnings have changed. This can happen when a company announces its quarterly earnings, and investors either gradually become aware of this announcement or they react to this change by incrementally executing a large order (so as to minimize market impact). And indeed, this leads to a momentum strategy called post earnings announcement drift, or PEAD. (For a particularly useful article with lots of references on this strategy, look up quantlogic.blogspot.com/2006/03/pocket-phd-post-earning-announcment. html.) Essentially, this strategy recommends that you buy a stock when its earnings exceed expectations, and short a stock when it falls short. More generally, many news announcements have the potential of altering expectations of a stock’s future earnings, and therefore have the potential to trigger a trending period. As to what kind of news will trigger this, and how long the trending period will last, it is again up to you to find out. Besides the slow diffusion of information, momentum can be caused by the incremental execution of a large order due to the liquidity needs or private investment decisions of a large investor. This cause probably accounts for more instances of short-term momentum than any other causes. With the advent of increasingly sophisticated execution algorithms adopted by the large brokerages, it is, however, increasingly difficult to ascertain whether a large order is behind the observed momentum.
Academic attempts to model regime switches in stock prices generally proceed along these lines: 1. Propose that the two (or more) regimes are characterized by different probability distributions of the prices. In the simplest cases, the log of the prices of both regimes may be represented by normal distributions, except that they have different means and/or standard deviations. 2. Assume that there is some kind of transition probability among the regimes. 3. Determine the exact parameters that specify the regime probability distributions and the transition probabilities by fitting the model to past prices, using standard statistical methods such as maximum likelihood estimation. 4. Based on the fitted model above, find out the expected regime of the next time step and, more importantly, the expected stock price.     This type of approach is usually called Markov regime switching or hidden Markov models, and it is generally based on a Bayesian probabilistic framework. Readers who are interested in reading more about some of these approaches may peruse Nielsen and Olesen (2000), van Norden and Schaller (1993), or Kaufmann and Scheicher (1996).
Turning points models take a data mining approach (Chai, 2007): Enter all possible variables that might predict a turning point or regime switch. Variables such as current volatility; last-period return; or changes in macroeconomic numbers such as consumer confidence, oil price changes, bond price changes, and so on can all be part of this input. In fact, in a very topical article about turning points in the real estate market by economist Robert Schiller (2007), it was suggested that the crescendo of media chatter about impending boom or bust may actually be a good predictor of a coming turning point.
The main method used to test for cointegration is called the cointegrating augmented Dickey-Fuller test,
The mean reversion of a time series can be modeled by an equation called the Ornstein-Uhlenbeck formula (Unlenbeck, 1930).
Given a time series of the daily spread values, we can easily find θ (and µ) by performing a linear regression fit of the daily change in the spread dz against the spread itself. Mathematicians tell us that the average value of z(t) follows an exponential decay to its mean µ, and the half-life of this exponential decay is equal to ln(2)/θ, which is the expected time it takes for the spread to revert to half its initial deviation from the mean. This half-life can be used to determine the optimal holding period for a mean-reverting position. Since we can make use of the entire time series to find the best estimate of θ, and not just on the days where a trade was triggered, the estimate for the half-life is much more robust than can be obtained directly from a trading model. In Example 7.5, I demonstrate this method of estimating the half-life of mean reversion using our favorite spread between GLD and GDX.
If you believe that your security is mean reverting, then you also have a ready-made target price—the mean value of the historical prices of the security, or µ in the Ornstein-Uhlenbeck formula. This target price can be used together with the half-life as exit signals (exit when either criterion is met).
(This research has been inspired by the monthly seasonal trades published by Paul Kavanaugh at PFGBest.com. You can read up on this and other seasonal futures patterns in Fielden, 2005, or Toepke, 2004.)
Besides demand for gasoline, natural gas demand also goes up as summer approaches due to increasing demand from power generators to provide electricity for air conditioning. Hence, another commodity seasonal trade that has been profitable for 13 consecutive years as of this writing is the natural gas trade: Buy the natural gas future contract that expires in June near the end of February, and sell it by the middle of April. (Again, see sidebar for details.)
Commodity futures seasonal trades do suffer from one drawback despite their consistent profitability: they typically occur only once a year; therefore, it is hard to tell whether the backtest performance is a result of data-snooping bias. As usual, one way to alleviate this problem is to try somewhat different entry and exit dates to see if the profitability holds up. In addition, one should consider only those trades where the seasonality makes some economic sense. The gasoline and natural gas trades amply satisfy these criteria.
For example, in a paper titled “Risk Parity Portfolios” (not publicly distributed), Dr. Edward Qian at PanAgora Asset Management argued that a typical 60-40 asset allocation between stocks and bonds is not optimal because it is overweighted with risky assets (stocks in this case). Instead, to achieve a higher Sharpe ratio while maintaining the same risk level as the 60-40 portfolio, Dr. Qian recommended a 23-77 allocation while leveraging the entire portfolio by 1.8. Somehow, the market is chronically underpricing high-beta stocks. Hence, given a choice between a portfolio of high-beta stocks and a portfolio of low-beta stocks, we should prefer the low-beta one, which we can then leverage up to achieve the maximum compounded growth rate. There is one usual caveat, however. All this is based on the Gaussian assumption of return distributions. (See discussions in Chapter 6 on this issue.) Since the actual returns distributions have fat tails, one should be quite wary of using too much leverage on normally low-beta stocks.
Let me elaborate on this capacity issue. Most profitable strategies that have low capacities are acting as market makers: providing short-term liquidity when it is needed and taking quick profits when the liquidity need disappears. If, however, you have billions of dollars to manage, you now become the party in need of liquidity, and you have to pay for it. To minimize the cost of this liquidity demand, you necessarily have to hold your positions over long periods of time. When you hold for long periods, your portfolio will be subject to macroeconomic changes (i.e., regime shifts) that can cause great damage to your portfolio. Though you may still be profitable in the long run if your models are sound, you cannot avoid the occasional sharp drawdowns that attract newspaper headlines.
Another reason that independent traders can often succeed when large funds fail is the myriad constraints imposed by management in an institutional setting. For example, as a trader in a quantitative fund, you may be prohibited from trading a long-only strategy, but long-only strategies are often easier to find, simpler, more profitable, and if traded in small sizes, no more risky than market-neutral strategies. Or you may be prohibited from trading futures. You may be required to be not only market neutral but also sector neutral. You may be asked to find a momentum strategy when you know that a mean-reverting strategy would work. And on and on. Many of these constraints are imposed for risk management reasons, but many others may be just whims, quirks, and prejudices of the management. As every student of mathematical optimization knows, any constraint imposed on an optimization problem decreases the optimal objective value. Similarly, every institutional constraint imposed on a trading strategy tends to decrease its returns, if not its Sharpe ratio as well. Finally, some senior managers who oversee frontline portfolio managers of quantitative funds are actually not well versed in quantitative techniques, and they tend to make decisions based on anything but quantitative theories.