Peak Trading Research

View Original

Mean Reverting Commodity Markets - Best Mean Reversion Strategy

We know that a lot of commodity markets are great breakout markets, i.e., markets where it makes sense to buy higher highs, and sell lower lows (see the full article here).

But what about mean reverting markets? i.e., commodity markets where it makes sense to sell higher highs and buy lower lows.

Now, there aren't many mean reverting markets in the commodity world, but today we're going to run 60,500 tests and find out which commodity markets are mean-reverting.

Let's get into it.

BUILDING AND TESTING A MEAN-REVERTING STRATEGY

Today, we're going to be building and testing a mean reversion strategy.

We're going to start with the same code from our breakout strategy article, and instead of buying higher highs and selling short lower lows, we are going to be selling short higher highs and buying lower lows.

This simple strategy is looking for markets that revert to the mean.

It's looking for markets that trade in a sideways channel.

Sample code for mean-reverting strategy

What is this complete trading system doing?

  • If the market closes at the highest level of the last 40 bars, the system will sell short.

  • If the system closes at the lowest level of the last 40 bars, the system will go long.

  • Exits: if 50 bars have passed, or if the trade has lost more than $3,000 per contract, this system will exit the long or short trade.

Again, this is a very simple trading approach.

If the market goes up, you sell it.

If the market goes down, you buy it.

You get out after a certain amount of time and you've got a stop loss.

Mean reversion. Simple stuff.

OPTIMIZATION TESTS

Using our Algo Lab tool at PeakAlgo.com, we can test those inputs in our strategy across a lot of different markets and bar sizes to really tell us what are the best mean-reverting markets.

We are going to test our length parameter from a value of 10 to 50. So if we were using daily bars in our chart, we'd be testing it from 10 to 50 days.

We're going to test a stop value from $1,000 to $5,000 per contract.

And we're going to test our exit bars also from a value of 10 days to 50 days.

So that's 5 (length) x 5 (stop) x 5 (exit) parameters = 125 different parameter combinations.

We're then going to test those 125 parameter combinations across 44 different futures markets and 11 different bar sizes, e.g., 60 min bars, 180 min bars, 360 min bars, etc.

125 parameter combinations x 44 markets times x 11 bar sizes = 60,500 different tests.

That's a total of 60,500 different tests that we're going to be running on this simple mean reversion strategy.

Algo Lab test parameters

TEST RESULTS - WHICH MARKETS ARE BEST?

After running 60,500 different tests on our simple mean reversion strategy, we can see that Nat Gas is a pretty good mean-reverting market. And Arabica Coffee works pretty well.

But there is one market that stands above them all as the king of mean reversion:

The Cocoa market.

If we look at a price chart of the Cocoa market, we can see that it exhibits some mean-reverting behavior.

It trades in a sideways pattern, where it generally makes sense to buy lower lows and sell higher highs.

Cocoa often trades in a sideways pattern and reverts to the mean.

And if we look at how this trading system has performed, we see a very nice, upward sloping equity curve (cumulative profit line), which means our simple mean reversion system has made money over time in the Cocoa market.

CONCLUSION

Although our simple mean reversion strategy doesn’t work in a lot of commodity markets, the good news is that our Algo Lab tool shows us that Cocoa is the world's #1 mean-reverting market.

If you're a professional Cocoa trader, you should really consider selling higher highs and buying lower lows. That is the trading approach that will make you the most money.

Hopefully, this article helps you build, analyze, and trade mean-reversion strategies across different agriculture, energy, and metal commodity markets.

For full access to our Algo Lab strategy testing tool, visit www.PeakAlgo.com and for our quantitative commodity research, visit www.PeakTradingResearch.com.