Wednesday 8 July 2015

A tale of two positions

Mostly running a systematic trading strategy is dull. Occasionally however something interesting happens. Here is a tale of two positions. One went well, the other badly. Examining these will also allow you to see 'under the hood' of my trading strategy, which you might find interesting. Also it illustrates the kind of diagnostics you need to have available on a systematic system (though there will be a longer post on this in my continuing series).

The last few weeks in the Agricultural markets have seen a pretty wild ride.
I found this headline interesting "Commodities jump most since february as corn, soybeans rally". I found it interesting not because I'm interested in weather reports from the US Mid-West, but because I am long soybeans, and short corn. Sure enough when I looked at my p&l for the last couple of weeks it was dominated by a large profit in soy; and a big loss in Corn.

But that is jumping ahead. Let's start by looking at why I had these positions on.

The setup

The picture for the first half of this year has been a gradual slide in Ags prices. Corn for example was down around 14%:

Soya wasn't much better, down around 10%.

What kind of positions did I have on, any why? Well I was short Corn:

Some explanation is needed. The top left is the 'signal'. This is in units that are risk adjusted, so they are comparable across different assets. Clearly I was short, and had been getting shorter all year. The top right and the bottom left show how the position is adjusted for the volatility of the asset price, and how much capital I am employing, respctively. In the bottom right is my position, or at least what it would have been if I could hold fractional contracts.
As for Soya:
Again I was short, although on a risk adjusted basis my position was only 2/3 of what it was in corn.

We can dig a little deeper. Here is the underlying signal breakdown by trading style for corn:

I have a short position on for 'trend' (which makes sense with the falling price'), and also because of 'carry'. And the same for soybeans:

Here the 'carry' signal is almost flat; and the 'trend' signal has started to fade. 'Carry' in this case just means that the market is in local contango. The contract I am trading is more expensive than a contract that has a nearer expiry. If the shape of the futures price curve is unchanged, the price of the contract I have should fall.

Let's see this in corn. I am trading the Z15 (December 2015) contract. The price of this is shown in the following plot as a green line (for the colour blind, the higher line).
I want to compare this to a nearer contract, U15 (September 2015) which is the blue, lower, line. If the shape of the forward curve remains unchanged I'll make money by being short Z15, as the price drifts down to U15. Here for Corn there is quite a big gap, hence the strong short carry signal.

Now for soya:

Here the green line that I am trading is X15 (November 2015), and the blue line for comparison again is U15. These two lines are almost on top of each other, but on average blue is above green - the reverse of what we see here. So there is a very slightly backwardation in soyabeans; which implies we should go long.

The rally

So we already know what happened next - prices went up. Here's corn:

20% in a couple of weeks is pretty good. Soya also saw a decent push:


As trend followers we don't try and forecast turning points, but we do react to them after they've happened. Here is how my system reacted for Corn. In the top left we can see the short signal compressing; falling by perhaps 3/4. The risk on the contract also increased (top right). The position then fell - these are the buys I did (columns are my ticket id, contract month, trade date and time, trade size, and price).

4087 CORN 201512 2015-06-11 14:30:00 1 373.000000
4291 CORN 201512 2015-06-24 14:30:00 1 378.750000
4303 CORN 201512 2015-06-25 18:11:08 1 391.250000
4354 CORN 201512 2015-06-30 17:18:26 1 412.750000
4390 CORN 201512 2015-07-02 14:30:00 1 430.000000


Above is the same picture for Soya. The signal moved from negative to positive - we've gone long.

4168 SOYBEAN 201511 2015-06-16 18:15:58 1 922.500000
4228 SOYBEAN 201511 2015-06-18 12:05:40 1 935.750000
4234 SOYBEAN 201511 2015-06-18 16:36:39 1 940.250000
4267 SOYBEAN 201511 2015-06-22 14:30:00 1 947.250000
4294 SOYBEAN 201511 2015-06-24 15:22:48 1 961.750000
4315 SOYBEAN 201511 2015-06-29 12:15:04 1 985.250000
4375 SOYBEAN 201511 2015-07-02 12:03:36 -1 1029.750000

Notice the last sell. This is because in the last few days of the plot the risk (top right) was jumping faster than the signal (upper left) was increasing. The former causes the position to fall, and the latter to increase it; net net I reduced my position slightly.

We can get some more illumination by looking at the signal breakdown. Here's corn:

And soya:

 Now carry hasn't moved very much; it's still quite short for Corn, and a little positive for Soya. However look closely at the 'trend' lines. For corn the trend signal goes from -0.07 to about zero. For soya it goes from -0.8 to +0.6. It's moved about twice as fast for roughly the same size of move. What's going on here?

Well we can breakdown the trend signal even further. Here is corn:

(Note: this is a simplification. I have four 'trend' subsystems, and we are seeing a break down here of just one 'momentum'. However it is representative of what was going on across the other subsystems)

 And soya:

The numbers indicate how quick the various trend following signals are. So 'momentum2' is a very fast system, which as you can see neithier instrument is using (flat lines in the plot). 'momentum 64' is a very slow one.

(If you are interested each is an exponentially weighted moving average crossover with spans N and 4N)

Notice that corn only has three systems - all slow- 16, 32 and 64. Whereas soya has five; and much of it's change in signal is coming from the fastest two - 4 and 8. That is why I react so much quicker to the price move in soya than in corn.

The next obvious question is why the heck do I have such different setups for the two instruments? The answer comes to to one simple thing - costs. Corn is simply too expensive to trade as quickly as Soya.

Both corn and soya have contract sizes of $50 per point, and have spreads of about 1/4 point wide; which implies that to trade I'd expect conservatively to pay slippage of 1/8 point; $6.25. On both I pay about $1.15 in exchange fees and commission per contract; so the total cost is around $7.40 per contract. However what matters is not the outright cost but the cost adjusted for risk (see chapter 12 of for more).

The volatility on corn is about half what it is on soya. So you need a position that is twice as big to get the same risk, which means doubling your costs.

Does this mean that trading corn will always be a money losing proposition? Not necessarily; if for example the current trend reverses at about the same speed it developed then I'd be more heavily whipsawed. However given that I don't know what trends will come up, all things considered it's always going to be better to trade an expensive instrument like Corn more slowly than something like Soybeans.

I would never use two weeks as a basis for judging my trading system. But for fun let's look at the p&l.

This year I've lost about -0.6% of my account value in corn:
But I've made about 1.3% in soya:
So the final lesson here is that diversification pays; had I just got one agricultural commodity in my portfolio; and had that been Corn, I'd be pretty sad right now.

Happy trading.


  1. Rob,
    In your book, I didn’t find the backtesting results of using carry rule on trending/ cyclical commodities like CL or NG. So I am just thinking if it adds any value to use a carry signal for trading commodities which are most of the time in contango or see-sawing between contango-backwardation and have higher tendency to trend?
    Maybe it makes more sense to use the carry rule for mean reverting instruments like volatility VIX and not for cyclical / trending commodities?

    1. No, carry does just fine in pretty much every asset class. I didn't include the results because they are widely available elsewhere, eg:

      Also see the 'expected returns' book by Illmanen



Comments are moderated. So there will be a delay before they are published. Don't bother with spam, it wastes your time and mine.