Wednesday, August 6, 2008

Trading Energy Complex Pairs

Over the last several months, it seems that every other financial blog has opined on the trading relationship between the Energy and Financial complexes -- so what's one more?!

While it has certainly been the trade du jour, it is perhaps one degree separated from the more intuitive Energy vs. Consumer Discretionary trade -- at least for this writer. But how to successfully trade these sectors against one another in an erratic market characterized by rapid rotation?

This article poses one possible short-term quantitative answer to the question using traditional long-short pairings of exchange traded funds, including: the Energy Select Sector SPDR (XLE) versus the Financial Select Sector SPDR (XLF), and the Consumer Discretionary SPDR (XLY), respectively.

Method & Rules

The premise will be to trade mean reversions after statistically extreme sector divergences. After scanning for such divergences, we will then employ pairings of the above ETFs whereby one stock will be held long and the other held short with equal dollar weightings.

The method and rules for this simplified trade follow:
  1. Divide the Daily Closing Prices of ETF-A by ETF-B;
  2. Calculate the Log of the Resulting Price Ratio.
  3. Calculate the 15-Day Moving Average of the Derivative Log Pair;
  4. Subtract the Average from the Current Result and Divide by the Pair's Trailing Standard Deviation ("SD") of the Same Length;
  5. Long the Derivative (Long A and Short B) when the Number of SD's Exceeds -2.2.
  6. Short the Derivative (Short A and Long B) when the Number of SD's Exceeds +2.2.
  7. Exit the First Close after: 1) the Pair has Mean Reverted past Zero; and, 2) the Derivative Ratio Moves Against the Trade for First Time. Obviously, there are many potential variations for Entries and Exits.
Easy, right? The sections below provide trading results for the two pairings over the most recent five-year period ended August 6, 2008 (1,263 trading days). As you will see, results are generally positive but far from consistent. In both cases, results have been strongest in 2008, though performance of the XLE/XLY pair has perhaps been more predictably consistent. No slippage or trading costs are assessed.

Results A ~ Energy vs. Financials (XLE/ XLF)


Results B ~ Energy vs. Consumer Discretionary (XLE/ XLY)


Closing Notes

Trading pairs can be notoriously tricky and it is not uncommon for both sides to move against the trader -- just look at all the reported hedge fund losses last month. Careful money management is needed, and the development of non-dollar weightings and intra-day rules may hold you in better stead than the simplified on-close method presented above.

If nothing else, I hope this article points you in the right direction for further study. These days, it certainly beats holding onto a theme based on discretion alone. In addition, you may find that tracking the relative success of various sector pairings provides advance notice of "what is working" beyond the trade du jour.

New! Mass Pairs Optimization & Analysis Feature on ETF Rewind



Addendum: Apparently I haven't been the only one with pairs on the mind. A morning visit to Dr. Brett Steenbarger's TraderFeed blog presents an excellent companion piece to this article. Here is the link to "Divergences and Pairs Trading." Dr. Steenbarger frequently writes about inter-market relationships in addition to his core articles on improving trader performance. Highly recommended. Also, a spelling correction -- of course it's "Du Jour" (of the day), not "Du Jure" (by law!).

NEVER INVESTMENT ADVICE

10 comments:

Ericd922 said...

Jeff- I came across your blog through Brett's blog entry on Pairs Trading. I trade commodities- both outrights & but have been focusing on spreads a lot more lately.

I had a couple of comments & questions.

1) Why are you dividing A / B? Most things I have done have just been subtracting A from B (after converting from point values to $ values for commodities with different $ point values) as thats the way the spread would be affecting your account balance.

2) I use tight stops with spreads as a mean-reversion entry seems to either work, or doesn't very quickly. Are you not using any stops?

3) Recently I have had a fair number of spreads go from the low (-2.2) to the high (+2.2), so you may be able to ride these trades longer.

4) This type of system would probably be uncorrelated to other systems people are trading, so there may be some additional positive impact from combining this method with other ones.

Great post. I look forward to reading others.

Regards,
Eric

Jeff Pietsch CFA, Esq said...

Hi Eric, thanks for your comments. I like to see a consistent ratio form and do use true range-type stops on my personal trades. Obviously there is more than one way to skin a cat; thanks for furthering the discussion!

Jeff Pietsch CFA Esq said...

NOTE TO MARKET REWIND READERS, THIS SPREASHEET IS NOW BUILT INTO ETF REWIND!

Jeff Pietsch CFA Esq said...

www.etfrewind.blogspot.com

stock market said...

Interesting post. Very informative and well written. I can use this as a guide as a trader. Thanks for sharing.

Anonymous said...

Very nice article Jeff.

I don't understand you are taking the Log of the (A/B).

Is there a reason why you are not using (A/B) directly?

Thanks!

Boris

jgpietsch said...

Thanks Boris, it is important that the calculation be symmetric to produce the same results whether you divide A by B or B by A. Price disparities can otherwise cause asymmetric results. Best, Jeff

Robert said...

Regarding taking the Log of the difference. What base are you using for the Log? I assume 10 ... correct?

jgpietsch said...

In this example I used Excel's natural log =ln() function. Best, J

Robert said...

I have a couple of questions re your Pairs functionality.

1) You show correlation (Chart B) but the trading rules only seem to take into account z-scores. Is my observation correct? I ask as one frequently seen pairs trading model
enters a trade when the z-score is at an extreme AND the correlation is above some level. If it's not used as part of system entry/exit is its primary purpose for visual inspection of the series?

2) Chart B is labeled as Rolling Correlation of Log Changes. Is each point in this chart:
a) The correlation coeff of the last N (Lookback period) days, i.e. how correlated are the last N days
b) A moving average of length N (lookback period) where each point being averaged is the correlation from the beginning of the series to that point

I ask these questions as I'm trying to increase my basic pairs trading knowledge and am reading everything I can find in that area.

Regards,
Robert