Trading Strategy: Oil Stocks vs Oil


This strategy was inspired by the recent Bespoke post Oil Stocks Outperforming Oil in which Bespoke showed the historical ratio between the price of oil stocks and the price of oil itself. I’ve reproduced their graph below.

Rising values indicate that oil stock prices are strong relative to oil, and falling values that oil stock prices are weak relative to oil.

In this post, I’ll demonstrate a strategy that uses this ratio to trade the oil sector.


I’m not sure what indices Bespoke used in their study, but the graph above is similar in spirit. I’ve used the Amex Oil Index (XOI) to represent the oil sector and the spot price of West Texas crude to represent the price of oil. ETFs such as XLE (oil sector) or USO (oil) could be substituted with basically the same results.

The next graph shows strategy results from early 1986 “trading” XOI using the following rules: go long at today’s close if the 9-day exponential moving average of the oil sector vs oil ratio is falling. Close the position and move to cash if it is rising.


Strategy results are in green, buy and hold in blue, and just for comparison’s sake, the opposite trading rules are in red.

This is a very simple proof of concept so these results are frictionless (i.e. do not account for transaction costs or slippage) and do not include return on cash, but for the sake of argument, these results could have been more or less duplicated using leveraged mutual funds (the only things I trade).

And for the number lovers:


In a nutshell, this strategy is buying oil stocks when they’ve become cheap (in an intermediate time frame) relative to oil itself, and exiting oil stocks when they’ve become expensive.

The strategy hasn’t been particularly profitable this year, but has at least scratched breakeven (compared to a ~40% loss for buy & hold). Strategy results YTD:


Conceptually, I think that this strategy makes perfect sense. I also think it has a lot of room for improvement because we’re only looking at oil stocks relative to oil, and not attempting to directly time the oil sector itself.

I’m going to keep this idea on my drawing board and see if I can’t build off of this observation. As always, more to follow.

Happy Trading,

P.S. at this moment, the EMA of the ratio is rising (i.e. oil stocks are expensive relative to the price of oil) so the strategy is neutral to bearish on oil stocks.

Geek Note: There are two generally accepted ways to calculate an EMA that produce slightly different results. Here I’ve used the ((1/Period)*2) method. If your charting program uses the (2 / (Period + 1)) method, simply reduce my period by one. For example, if I’ve used a 9 period EMA, the alternate EMA would be an 8 period EMA.


To stay up to date with what’s happening at the MarketSci Blog, we recommend subscribing to our RSS Feed or Email Feed.

19 Responses to “Trading Strategy: Oil Stocks vs Oil”

  1. 1 Eric van der Walde

    I certainly think the concept has merit. However, you cannot assume that WTI spot oil index returns and USO returns are interchangeable. The USO holds the prompt WTI futures contract. Every time that future expires they need to roll into the new prompt contract. When the market is in contango(prices increase out in time) like now, they loose money selling the expiring contract and paying more to buy the new prompt contract. That is why the USO is trading at $29 and change and the current prompt future is $38.5. That $9.50 is essentially the cumulative loss on rolling the contract, as well as the management expense.

    As for the spot WTI cash price, that is not something tradeable for too many people who read your blog. It is a physical energy market price and without access to that physical market place and physical oil storage you cannot hold Cushing spot crude. To the extent that spot price is correlated with the prompt futures contract you would actually think you are making money when the futures rolls in a contango market. As an example lets say spot and prompt futures are perfectly correlated, obviously not really the case. Say they are both $40 the day before expiry and the second future is $44. USO rolls at expiry and looses 10% (they sell contracts at $40 and turn around buy at $44). However, spot moves from $40 to $44 to correspond to the new prompt future. If you had physical oil in storage unhedged you could mark up your inventory 10%. Without that physical oil in storage you made nothing. When you calculate the return of the spot index you would calculate a positive 10% return. The return you would calculate from that index would have the opposite sign from the roll return. In reality the spot price does not jump up to the new prompt futures price but converges over time, either way, you miss the negative roll return inherent in the USO price and have a phantom return from the spot not obtainable without a physical oil storage position.

    You should rerun you analysis actually using USO instead and I bet your results will be significantly different. For all I know they may be better, but they will be actual returns realizable in the market to retail or financial only institutional investors.

  2. 2 marketsci

    RE to Eric: my attempt at being brief wasn’t clear – my apologies – what I meant is that the results of the strategy would be more or less the same if you replaced USO with WT spot – I tested that to confirm that it would still work when I originally ran the numbers. I settled on using WT spot for this study because of the significantly larger amount of historical data available.

    Having said all of that, thank you anyways for a thorough handling of the difference between the two data sources =)


  3. 3 Eric van der Walde

    Have you looked at trading a spread between oil stocks and USO? I know calculating the hedge ratios could be problematic but it could be interesting.

  4. 4 marketsci

    RE to Eric: I haven’t yet, but I think that has potential. Added to the to-do list. Thanks, michael

  5. 5 Russ Abbott

    The rule is “go long at today’s close if the 9-day exponential moving average of the oil sector vs oil ratio is falling. Close the position and move to cash if it is rising.” If you look at oil and oil stock movement separately and then compare them, It seems to me that there are four different cases. (1) Oil is leading oil stocks upwards, e.g., rising faster or rising earlier. (2) Oil stock are leading oil upwards. (3) Oil stocks are leading oil downward. (4) Oil is leading oil stocks downward. As I understand it, the rule says to buy oil stocks in cases (1) and (3) and to get out of the market in cases (2) and (4). (Is that a fair analysis?)

    It seems that the underlying premise (or fact) is that a rise in oil prices is good for oil stocks. If that’s the case, then

    Case (1) says that oil stocks will do well when oil prices increase as long as the stocks haven’t fully priced in that increase. It makes sense to buy oil stocks in this case.

    Case (2) says that oil stocks are ahead of oil in anticipating the advantage of an upward move in oil prices. It makes sense not to buy oil stocks in this case since they may already have priced in the benefit of an increase in oil.

    Case (3) says that oil stocks have over compensated for a decline in oil prices. Perhaps oil stocks are under priced, but if they are correctly anticipating a negative effect of oil price declines, this case may be a bit iffy as a buy signal.

    Case (4) says that oil stocks have not yet reacted to a fall in oil prices, which presumably would be bad for them. It makes sense in this case to say out of oil stocks.

    So I would suggest an alternative rule. Buy oil stocks in case (1), short oil stocks in case (4), be neutral in cases (2) and (3).

    Case (1) is the ema of the ratio is positive and the ema of oil is positive.

    Case (2) is the ema of the ratio is negative and the ema of oil stocks is positive.

    Case (3) is the ema of the ratio is positive and the ema of oil stocks is negative.

    Case (4) is the ema of the ratio is negative and the ema of oil is negative.

  6. 6 marketsci

    RE to Russ: I like your line of logic. If I recall, I tested the above basic set of parameters and I didn’t include them here (which tells me not all was at it seems). Let me runs the numbers again and I’ll put out a post in the near future. Really like this kind of “thinking man” commentary. michael

  7. 7 marketsci

    Russ – if you don’t mind me asking, where do you hail from? michael

  8. Thanks, Michael.

    I teach Computer Science at Cal State, Los Angeles.

    Your site says that in a previous life you were an engineer. Would you mind saying more about your background. Also, you say you are writing a book about adaptive market strategies. How far along is it?

    One of my favorite areas to teach about is complex systems–and especially evolutionary systems like genetic algorithms and genetic programming. If I had time, I’d do some work applying that technology to the markets. But you know how that goes. Perhaps I can find a student who will be interested. That’s why I asked about the data sources you used.

    I know that there is quite a bit of academic work in this area, which I haven’t been following. (It surprises me that you have done so well considering how low profile much of the work is. I suspect its low profile reflects a lack of impressive results.)

    If you want to go to Lisbon in a couple of weeks, you might be interested in this conference: Or here’s one in Singapore:

    This one ( Is over, but presumably there will be another one this coming year.

    — Russ

  9. 9 Merwan

    Quick question: you’re using the 2:30pm WTI settlement together with the 4pm oil stocks close to compute the ratio ?

  10. Michael,

    You should also try this with other commodities, they should be the same. I looked into a cointegration strategy for GLD and GDX (gold vs gold miners) a few months ago that showed good results.

    By the way, your blog’s style is great and you do a good job integrating the charts.


  11. 11 marketsci

    RE to Max: you’re one step ahead of me – it’s on the to do list, and I agree, gold vs gold stocks seemed like the best next candidate. Thanks, michael

  12. 12 marketsci

    RE to Russ – thanks for the links – will review.

    In regards to the academic research that’s been done on adaptive trading systems – I’ve dug into a bit of it and between you, me, and the fencepost, I haven’t been overly impressed. I think a lot of it could be characterized as just extreme curve-fitting. I think that (like most things in trading systems design) simple, logical, non-optimized approaches prevail in real-time out-of-sample trading. But that’s just my $0.02.

    P.S. one of my fears in writing this book is that extremely academic oriented types are going to look at some of the approaches and say wow this is really elementary. But at the end of the day, that elementary approach is very intentional (and a lot more accessible to the joe trader).

    Thanks for all the great comments you’ve left here and happy new year!


  13. 13 marketsci

    RE to Russ: one more comment – expect a follow up post in early January to your “4 flavors” comment earlier in this thread. Have run the numbers, just waiting on a good time to write it up.


  14. 14 BIll

    How do you handle taxes? Is the comparison between buy and hold and the active strategy only accurate for IRA/401k environments?

    I would assume that the active strategy would generate tax payments every year that would impact it’s actual, real-life return.

    Any comments?

    Love the website.

  15. 15 marketsci

    RE to Merwan: I’m about 99% sure that that is correct – I’m using 3rd party raw data, but I believe that’s how they’re calc’ing the spot. Of course, because we’re trading the later close (oil stocks) and not the earlier close (oil spot), there’s no “peeking”. Thanks, michael

  16. 16 marketsci

    RE to Bill: correct. There are multiple real-world considerations that would impact results: taxes, transaction fees and slippage (if trading an ETF) or fund expenses (if trading a fund), as well as return on cash.

    Generally, I don’t share systems that are intended to be directly traded as written. They’re concepts that can be mixed and matched to create a more holistic view of the markets (such as on the SOTM report). If attempting to execute a particular strategy alone, the trader would really need to retest based on their own unique circumstance (taxes, etc.).

    Thanks for the good comment (and kind words),

  17. Michael, thanks, this is some intriguing work. It gives me ideas for further research.

    In a previous life I was a spread trader in various futures pits (calendar spreads and inter-market arbitrage), so I’m a huge fan of relative value ideas like this.

  18. 18 Roger Cox

    Is there a good source for obtaining current and historical futures curves (contango and backwardation) without having to dig through the data and construct the charts? I would like to compare the current super-contango for oil with other periods of time.

  19. This is strange as often the commodity outperforms the companies on the upside.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s