Pairs trading is the simplest ``dollar neutral'' trading strategy possible. A dollar neutral trading strategy is one where no outlay of money is needed. In reality, even such strategies require some outlay, if only to meet margin calls and brokerage fees.
In pairs trading, one stock is bought long at the same time an equal dollar value of another stock is sold short. The hope is that at the end of the trading period, the net position has gained in value. It is often assumed incorrectly that the stock bought long is one which is expected to increase in value, and the one sold short is one expected to lose in value. This is not a requirement for the strategy, it works equally well for both the long and short to simultaneously increase or decrease in values, as long as the net strategy gains in value.
Choosing which pairs to trade is not easy. Any methodology to choose pairs for trading has to
The best that this application hopes to achieve is to let the user test historical effectiveness of a particular ranking function. These are two of the three criteria for choosing a methodology. It is very likely and possible that better selection of sample data and ranking function provides better predictions of future performance.
Because a pairs trading strategy is dollar neutral, measures of portfolio performance that involve logarithmic returns are inapplicable since the initial value is zero. The Sharpe Ratio (ratio of annual return to annual standard deviation of return) on the arithmetic return is used as part of the ranking function. The Sharpe Ratio is invariant to scaling of the initial size of the stock positions and thus gives a good comparision of the different pairs independent of their initial stock positions. However, the absolute return is also important since margin requirement and brokerage costs are functions of position size. The return of the portfolio must also factor into the ranking function.
The ranking function used in the application is
Ranking Function = Sharpe Ratio * Return.
This function has the following properties:
If there is a particular holding horizon that is important, make sure that the ending date of the sampling data is at least that distance from the current date. For example, if today is 1/1/2010, and the holding period is 2 years, one might have starting date for the sampling data of 1/1/2005 and ending date for the sampling period of 1/1/2008. The application will then show the effectiveness of using 3 years worth of data (1/1/2005 to 1/1/2008) in choosing a trading strategy for the following 2 years (1/1/2008 to 1/1/2010). The application can then be rerun with an ending date for the sampling data of 1/1/2007 to creating a ranking for the out of sample period (1/1/2007 to 1/1/2010) which uses the most current 3 years for actual trading.
Pairs of stocks are listed in order from highest to lowest based on the value of the ranking function when applied to the sample data. The pairs of stocks are listed with the stock being long as the stock that is alphabetically earlier than the stock being shorted. Statistics are listed for the sample period and for the "out-of-sample" period, this is the period from the end of the sample period to the most recent data available. This gives a comparision to how actual performance would have been if the sample period information was used in actual trading.
The annualised standard deviation of returns for the strategy for the sample period and out of sample period are listed. Similarly, the annualised return for the strategy for the sample period and out of sample period are listed. The rank function is also computed for the sample period and out of sample period.
The most important number is that listed at the top of the analysis. This is the "Spearman Rank Order Level of Significance" which is a statistical test of the power of sample ranking to predict out of sample ranking. The lower this number, the more likely the two rankings have statistical significance and not just a fluke. For example, a value of 5%, means that correlation observed between the sample ranking of pairs and out of sample ranking of pairs would only happen by chance 5% of the time given truly independent processes. This correlation may be positive or negative, the sample ranking may be a negative predictor of out of sample performance.
This application is just a simple stock pairs trading analysis tool. Extensions of this basic idea include