Energy Stat Arb

Back to my roots. Haven’t tested outright entry exit trading systems for a while now since the Mechanica and Tblox days but I aim to post more about these in the future.

I’ve been looking and reading about market neutral strategies lately to expand my knowledge. Long only strategies are great but sometimes constant outright directional exposure may leave your portfolio unprotected to the downside when all assets are moving in the same direction. A good reminder would be the May of last year when gold took a nose dive.

Below are some tests I conducted on trading related energy pairs. Note that I haven’t done any elaborate testing for whether the spread is mean reverting,etc. I just went with my instincts. No transaction costs. Spread construction based on stochastic differential, 10 day lookback, +-2/0 std normalized z score entry/exit, and delay 1 bar execution.

Crude Oil and Natural Gas Futures (Daily) (Daily don’t seem to work that well no more):

CL-NG

OIL and UNG ETF (1 Min Bar)

OIL-UNG

XLE and OIL ETF (1 Min Bar)

XLE-OIL

Pair trading is the simplest form of statistical arbitrage but what gets interesting is when you start dealing with a basket of assets. For example, XLE tracks both Crude Oil and Natural Gas companies, therefore a potential 3 legged trade would be to trade XLE against both OIL and UNG. Another well-known trade would be to derive value for the SPY against TLT (rates), HYG (corp spreads), and VXX (Vol).

The intuition behind relative value strategies is to derive a fair value of an asset “relative” to another. In basic pair trading, we are using one leg to derive the value of another, or vice versa. Any deviations are considered opportunities for arbitrage. In the case for multi legged portfolio, a set of assets are combined in some way (optimization, factor analysis, PCA) to measure the value. See (Avellaneda) for details.

While the equity lines above look nice, please remember that they don’t account for transaction costs and are modelled purely on adjusted last trade price. A more realistic simulation would be to test the sensitivity of entry and order fills given level 1 bid-ask spreads. For that, a more structured backtesting framework should be employed.

(Special thanks to QF for tremendous insight)

Thanks for reading,

Mike

8 comments

    1. Hi Craig, sorry but I am not planning to release the code for the backtest as it’s built on a backtest framework that is proprietary. I always release code when I am prototyping a strategy in R but this is built in my python environment.

      On the other hand, I am open to any question about the strategy and all it’s logic as I’ve shared it.

      Mike

    1. I should of made this more clear in the post.

      To calculate the stochastic differential:

      [ close_t – lowest_low_(t-lookback : t) ] / [highest_high_(t-lookback : t) – lowest_low_(t-lookback : t) ]

      Where t = today

      Calculate for both legs and take the difference and then normalize with Z-score.

  1. Hi Mike,

    may I ask you to clarify a little bit on your algo. I am trying to replicate the results for OIL/UNG but for some reason they differ. Equity curve above suggests you use 1 minute bars data. To calculate stochastics it’s said you take 10 days lookback period (approximately 1800 minutes). Then you transform stochastics difference to z-spread – are you using the same lookback period for that transformation? Do you use dollar neutral position sizing scheme or something else? If so I do get different results or maybe do I misinterpret something?

    Kind regads,
    Alex

Leave a reply to Systematic Edge Cancel reply