How to Build a Systematic Spread Trading Strategy

by Andrea Unger

Need More Help? Book Your FREE Strategy Session With Our Team Today!

We'll help you map out a plan to fix the problems in your trading and get you to the next level. Answer a few questions on our application and then choose a time that works for you.

BOOK YOUR FREE STRATEGY SESSION NOW >>

 

Among the trading approaches used by hedge funds, there is spread trading: a strategy that lets you increase your portfolio diversification while giving priority to risk management.

Spread trading seeks to exploit the inefficiencies between two different but closely related instruments by opening opposite positions.

In this video, one of our coaches shows you how to develop an automated strategy that can make spread trading operations on two bond futures with a different duration, the 30-Year T-Bond and the 10-Year T-Note.

Enjoy! 😊



Transcription

Hello everyone! I’m one of the coaches of Unger Academy and today we’re going to be talking about a technique that is mainly used by institutions and hedge funds, but which could also be studied and used by systematic traders like us. I'm talking about spread trading or, as it is also called, arbitrage.

 

As always, let's start with a quick overview of the general concepts on which this kind of approach is based. 

 

"Steepening & Flattening"

So today we're talking about spread operations. These trading operations can represent a good form of investment in which risk retention is used to further diversify a portfolio of trading systems.

 

Spread trading (which is also called arbitrage) is a trading strategy that involves both a long entry and a short entry, or in any case, two opposed entries that occur simultaneously, so at the same time, on two different but correlated markets. 

 

For institutions such as investment banks, hedge funds, family offices, and in general, for traders around the world, this is an excellent investment opportunity. But let's see why it is so interesting.

 

First things first, by buying and selling two related assets you have the possibility to somehow “hedge” your positions. In fact, this approach can help you limit risk – at least the one you perceive – ancd protect your account. Since one of the two assets you trade will always rise or fall more than the other one, there will always be an opposite position that protects your account from possible shocks. This is very important, for example, for the customers of the banks I’ve just mentioned, who prefer to contain the drawdown because of their low tolerance for risk.

 

Another reason why this strategy is so interesting is that it’s based on inefficiencies that can be found, for example, between a corporate bond and an opposite market such as a credit default swap. Credit defaults swaps, which you can probably remember from the 2008 crisis, are instruments that were created to hedge against the default risk of a given bond. They are like some sort of insurance that, if you buy it, increases in value as the risk of default of the bond increases. 

 

But there are also other examples based on structural economic principles. Think of two bonds that have a different duration; they will always have different returns, so you can exploit them to your advantage by opening opposite positions on them. A 30-year bond will obviously be riskier than a 6-month BOT, because the price of the bond will be affected by the fluctuations that will occur over the next 30 years, and it's plain to see that a lot can happen in such a long period of time compared to what can happen in just 6 months. 

 

In this regard, I’d like to show you a strategy based on this principle that is within the reach of systematic traders like us. Based on what we have just said, here's what stands at the core of this strategy: given the fact that a bond with a longer duration is riskier because it tends to move more than a bond with a shorter duration, then we could try and build a trading system that, under certain conditions, buys a bond and then sells the other one over time. 

 

The spread curve between the two bonds would have alternate moments of  'Steepening', that is, moments when the spread tends to widen, and 'Flattening', that is, moments when the spread is compressed in a range. 

 

So what would happen if, in the 'Steepening' moments (i.e. when the spread widens) we systematically buy the bond with the longest duration (which is therefore the most risky one) and sell the one with the shortest duration? And obviously, if in the 'Flattening' moments, we buy the bond with the shortest duration and sell the one with the longest duration?

 

In the upper part of the screen you can see the charts of the 30-year bond, whose ticker in TradeStation is US, and of the 10-year bond, whose ticker in TradeStation is TY. These two bonds are clearly correlated with one another, since their prices move in a very similar way. Then, in the lower part of the screen, you can see a red line that represents the spread between these two bonds. By looking at this image, you can see that the line of the spread is rising, especially in the more recent years. 

 

So, the first step is to identify the steepening and flattening moments to get some signals for our trading systems. The steepening moments, which here are highlighted in yellow, are the moments when the spread basically grows, whereas the flattening moments are the moments when a sort of sideways trend occurs, and as you can see they are different and even opposed to the steepening ones.

 

How to translate the idea into code

The next step consists in translating these pieces of information into code, and if you're wondering how we can do that, the answer is – MultiCharts. As I've already told you in other videos, MultiCharts is not one of those overcomplicated platforms that only aerospace engineers can use. Actually, we all can use it to carry out this kind of test. The instruments we're going to use are once again Futures. In particular, we will use the US 30-year Treasury Bond Future and the US 10-year T-Note Future, which is correlated to the former but has a much shorter duration. As for the timeframe, we're going to use 1440 minutes. Basically, 1440-minute bars correspond to a daily timeframe. However, since they are not adjusted at the end of the day by the different data providers, these bars are more accurate, and that's why I recommend that you also use 1440-minute bars.

 

Now we need to figure out how to identify the moments of steepening and flattening in order to be able to tell everything to the machine through a condition that fits into our idea.

 

For example, I created these scripts. One will be applied to the US and the other to the TY. In these scripts, I use a simple 100-period moving average to identify the two moments (steepening and flattening). I used 100 by convention because it is a round number and therefore it shouldn't configure any overfitting cases. 

 

One glance is enough to see that this indicator seems to split the moments of steepening and flattening quite well. Here in the chart, you can see an example of the pattern we have identified. When the red line crosses its 100-period average from below, then we will buy the 30-year bond and sell the 10-year bond. Conversely, of course, when the spread crosses the average from above, we will do the opposite, so we will buy the 10-year bond and sell the 30-year bond.

 

So let's go back to Portfolio Trader and launch these two strategies that, as I've already said, should be seen as a whole. In fact, we need to open two opposite positions, which means that we either open a long position on the TY and a short position on the US or vice versa. The aim is to always be 'hedged' and be able to somehow limit the risk.

 

But before we run the backtest, let's see graphically if our strategy actually makes the trades we want, that is to say, the opposite trades we just talked about. The upper chart refers to the 30-year bond, the US, while the lower one refers to the American ten-year bond, the TY. 

So let's check out if we wrote everything correctly. As you can see, the strategy actually opens opposite positions. In fact, when the system goes short on the 10-year bond it also goes long on the 30-year bond, and this happens throughout the whole data history. This information is very important for testing our idea because otherwise, that form of spread from which we are trying to profit would decay.

 

So the strategies are working correctly. I remind you that we're using two strategies, one that works on the TY and the other that works on the US.

 

Great, so now we can go back to our portfolio and run the backtest. 

 

Portfolio Test

Here you can see that we’re using the first strategy with data1 for the TY and data2 for the US, and vice versa, in the second strategy we’re using data1 for the US and data2 for TY.

 

We start the test from 2002. Even if I set 2000 as a starting date, the data provided by TradeStation starts from 2002, so the test actually starts from 2002 and continues up to September 2021, a period that is certainly long enough for this test.

 

We open the results and… Well, we're pleasantly surprised. The portfolio as a whole makes money - we see it here - which means that the moving average is actually able to properly identify the steepening and flattening moments. The drawdown seems to remain fairly stable over the years. Anyway, perhaps in this case it would make more sense to look at the close-to-close drawdown (since the position is always hedged in some way). The total net profit of the strategy is about $55,000, with a close-to-close drawdown of $8,500. So these are definitely some reasonable results. Let's also take a look at the average trade, which is the thing that worried me most because making two trades means paying double slippage and commissions. Fortunately, the average trade is quite large. It's about $133, so considering both strategies we can certainly be satisfied. Looking at this report it immediately catches the eye that in this case, the short trades produce an average loss of over $300 while on the long side we have an average trade of about $600, and $133 is the average of the two. 

 

So the first thing that comes to mind is to eliminate the short side. This would obviously eliminate also the hedge mechanism that lies at the core of this strategy, but the idea is certainly appealing. Personally, these results make me wonder if things would improve by eliminating the short side. 

 

So, just out of curiosity, and since this could be quite interesting, I'd like to quickly show you what happens when we replace the 'sellshort' instruction with 'sell'. I replace it in both scripts so that the two strategies just close the long positions without opening any short ones. As you know, in MultiCharts/PowerLanguage the 'sellshort' instruction is used to open a short position, while the 'sell' instruction is used to close a long position. 

 

So now that we've compiled the scripts let's take a look at the results. In the report, which obviously shows only the long side, we can see that the average trade is now $575. Let's take a look at the equity line. And yes, it's certainly better than the one we get trading both long and short, and it even makes more money. So let's look at the figures. As you can see, the net profit reaches almost $118,000, which is definitely a good result compared to the $55,000 we saw before. Of course, this is due to the very strong bullish bias that characterizes these markets. 

 

There's only one "but": this time, the close-to-close drawdown is higher. Look at this. In the previous case it was $8,500, now it exceeds $13,000. Overall, these results suggest that keeping the short side and staying hedged would probably be more useful, or at least, it would have a good effect on the drawdown. However, it certainly wouldn't help with the net profit, which is about a half. 

 

By the way, there's a lot of room to improve this strategy through further development and optimization, for example by adding a stop loss to avoid the worst cases of the two strategies. Obviously, this means getting further and further away from the initial idea at the core of this spread trading approach, which in any case already works pretty well.

 

Conclusion

And you know, a lot depends on how much risk you can tolerate and, in general, on the kind of strategies you feel more comfortable with. 

So it's really up to you to choose whether to break the "insurance", let's call it this way, and accept a bigger drawdown, or keep it and, why not, work to refine the basic idea. 

 

So it's time for you to investigate and further explore this idea, which you can do using the method that we teach at Unger Academy. In this regard, in the description of this video, you can find a link to a webinar where you can learn more about trading systems. 

 

Thank you for your attention, and we’ll see in the next time! Bye bye!



Need More Help? Book Your FREE Strategy Session With Our Team Today!

We’ll help you map out a plan to fix the problems in your trading and get you to the next level. Answer a few questions on our application and then choose a time that works for you.

BOOK YOUR FREE STRATEGY SESSION NOW >>

Andrea Unger

Andrea Unger here and I help retail traders to improve their trading, scientifically. I went from being a cog in the machine in a multinational company to the only 4-Time World Trading Champion in a little more than 10 years.

I've been a professional trader since 2001 and in 2008 I became World Champion using just 4 automated trading systems. 

In 2015 I founded Unger Academy, where I teach my method of developing effecting trading strategies: a scientific, replicable and universal method, based on numbers and statistics, not hunches, which led me and my students to become Champions again and again.

Now I'm here to help you learn how to develop your own strategies, autonomously. This channel will help you improve your trading, know the markets better, and apply the scientific method to financial markets.

Becoming a trader is harder than you think, but if you have passion, will, and sufficient capital, you'll learn how to code and develop effective strategies, manage risk, and diversify a portfolio of trading systems to greatly improve your chances of becoming successful.