I developed the concept of intermarket divergence approximately 20 years ago. It has proved to be a powerful concept since then. Reflecting back to 1995, I realized that the development process was interesting. I was developing many futures-based trading systems then. The problem with futures is that most backtests and systems are based on continuous contracts. Futures contracts do not last very long, however. The active period of a futures contract generally occurs close to expiration so its effective trading length may only be a few months.
In order to test long-term trading systems for futures trading, traders use a method of stringing these contracts together to make a continuous series. They call this series a “continuous contract”.
The tricky part of stringing contracts together is that they rarely trade at the same prices. Therefore, they do not naturally splice together smoothly (i.e. when you join them, you will get many obvious disjoints). Traders have various ways to cope with the problem of making this continuous contract from individual deliveries.
In a splice chart, we simply ignore this problem and create a chart without any attempt to adjust prices to make a smooth transition. So at every join, the price jumps up or down by the price difference at the day of joining. For example, S&P futures occur at 3-month intervals (March, June, September, and December) so S&P splice charts typically have a price jump every three months.
Using continuous contracts destroys the relative price level but maintains the daily range since futures profits are proportional to points. This is fine. Profits are not based on percentages which works out well as that information is destroyed using this method. When doing classic intermarket analysis, ratio is often used. The problem is that you can’t use ratio on back-adjusted futures contracts. Ratio was a way to detect mispricing when the ratio finds extremes. So I developed the concept of intermarket divergence as a way around this. I wanted to find a way to accurately judge that the relationship had reached an extreme level. The rules for intermarket divergence are as follows:
For positively correlated markets:
- If intermarket is in an up trend and the traded market is in a down trend, then buy
- If intermarket is in a down trend and the traded market is in an up trend, then sell
We have similarly worded but conceptually different, rules for negatively correlated markets, so:
For negatively correlated markets:
- If intermarket is in an up trend and the traded market is in an up trend, then sell
- If intermarket is in a down trend and the traded market is in a down trend, then buy
You can use various well-known concepts to define an up or down trend. In most of my work, I used price relative to a moving average. That is, consider a function called Price-Average (Price, X, 0) that we use to define a trend. When it is above zero we call it an uptrend and when it is below zero we call it a down trend. We can also use a simple difference Price-Price (X) function as another method for defining a trend.
Let’s now look at some examples of this methodology. The classic example that I like to share is the one that has been the most robust over the past 25+ years: the relationship between the 30-year treasury bonds and the Philadelphia Electrical Utility (UTY) average. We have discussed it before, but for the sake of illustrating some new concepts, we will go over it again. First, I’d like to share an optimization that I did in TradersStudio (my own backtesting platform) using Pinnacle Data first. The reason I chose this is due to the fact that TradeStation data is only available back to 2001 for a US continuous contract.
Consider the following results. We will use a new out-of-sample period. We will use as the in-sample training period 9/22/1987 to 4/10/2010. Our first parameter is the traded market and the second one is the intermarket. We are deducting $50 slippage and commissions. Finally, we are assuming a positive relationship between the 30-year bonds and the UTY.

The (8, 18) set of parameters was originally selected as the best set of parameters in 1998 when I did this optimization 17 years ago. It was not done by selecting the best set of parameters for the highest profit, but rather looking at the neighboring parameters for performance. I did this by looking at the 3D parameters space so that way I can see how well each parameter does next to its adjacent options. Based on my current analysis, the best set of parameters and the one with good neighboring performance is (8, 20). This is not common but in this case the best set of parameters and the most robust, in my opinion, is actually (8, 20).
Let’s now consider another test. This will be our bogey test. Instead of using two markets, we will use one and consider different length moving averages. We want to see if using treasury bonds versus UTY is a different distribution than using two different length moving averages of treasury bonds. We optimized using the same in-sample period. We found the following for the top 20 sets of parameters.

There are a few obvious differences with this optimization. First of all (and the one that is most striking) the best set of parameters makes about $90,000 less. Also unlike the optimization with UTY, almost none of the combinations make money on the short side.
Let’s now run our Z test between the two populations to see if the difference is statistically significant.
Net Profit Mean | Net Profit StdDev | |
---|---|---|
US/UTY | 70352.59 | 54375.9 |
US/US | -8791.55 | 70664.03 |
Z Test | 0.887629 |
This score puts us above the 80% level that the distributions are different and UTY as an intermarket adds value. Although this falls short of the “95% confidence level” that is often used, it is still very good considering noise and the plethora of other factors that go into the price of bonds.
Given that it seems like this relationship is promising, let’s look at our out-of-sample results through 4/10/2015. With a first trade on 4/28/2010 to date 4/10/2015, we have made almost $47,875 out-of-sample. Even though the last two years have not done superb, the total from the out-of-sample plus the fact that this relationship has worked since 1998 shows me that it is predictive.
There is an important property of intermarket relationships that affects trading performance that we’ll show now in TradeStation. It is a very powerful property that can turn a good system into a great system. First, before doing the TradeStation analysis, we need to double check that the results we get from TradeStation are similar to the results we got from TradersStudio. Considering the out-of-sample period using TradeStation data, the results I got for the system above are close, but not identical, with $46,793.75 being made during this period. This is close enough that we can switch to TradeStation for the rest of our analysis.

Taking a look at the above chart, we can see vertical lines where the equity curve crosses. The windows between crosses can last 2-4 months or even longer and also contain multiple trades. The October 2014 equity pullback and the large losing short trade within that window match a relatively large selloff in the stock market (approximately 7%-8%). The down trend in UTY was not due to intermarket arbitrage because it happened so fast. This gave a false sell signal. By only trading the system when the equity curve is above its moving average, we could greatly enhance this system.
For example, taking a look at the period from September 11, 2010 to September 26, 2011, the equity curve was above the moving average of equity for 10 of the 12 months. During the two months we did not stay above, we were crossing above and below the moving average about an equal amount of time and staying very close. This period of positive equity performance accounted for over $40,000 in profits! Notice too how the trades that are made tend to be correct during this time. That is, a short is followed by a buy that is lower and vice-versa.

This shows that equity curve feedback is very useful in intermarket divergence analysis. In addition, it is important to note that we must take intermarket relationships in context. In our previous example, the major selloff of October 2014 caused the bond to UTY relationship to decouple.
The other big takeaway from this analysis is that these relationships are very powerful when they work. We can use context like equity curve analysis as well as intermarket context and correlation, to develop mechanical methods to turn on and off these relationships. This is why short out-of-sample bad performance periods does not mean that an intermarket relationship is not valuable. Short out-of-sample bad performance could be due to an anomaly in the intermarket context (e.g. the Fed making an unexpected move). However, my experience is that using equity curve feedback helps filter out some of these anomalies and makes trades when the relationship is statistically sound.
Recognizing this fact in my TradersStudio package, I have three backtesters built in to the platform. One of these does the actual trading, and the other two are used for advanced analysis like equity curve feedback. A few years ago, I developed a set of tools (less flexible than TradersStudio but very powerful) which can do equity curve feedback in TradeStation for a simple system that enters and exists at the market value.
With all this in mind, we can now consider some classic intermarket relationships over a long period both end-of-day and intra-day. In the context we have painted here, you can see that even some intermarket relationships which are not quite ready to be traded live (e.g. ones that average $50-$100 per trade) might still be useful as part of an indicator that is used as fraction of a larger trading method or with filters. Also, using multiple confirming intermarkets will also allow these markets that give us small edges to be combined into something that represents a quality cohesive system.
Example Valuable Intermarket Relationships
Even though I have been calling the method I developed “intermarket divergence”, it should be noted that the “markets” need not always be true markets. That is, it needn’t always be an actual entity that can be traded. We can use indicators like VIX, Trin, advances/declines, put/call ratio, and so on to provide a framework for a strategy within intermarket divergence. Let’s now study some classic relationships and discuss them more detailed. In order to simplify our analysis, we will not break out data into in-sample and out-of-sample data, but we will look at some of them in different optimization windows.

Some notes about the above table:
- SLV is the iShares Silver Trust
- GDX Market Vectors gold miners ETF
- IEZ iShares US Oil Equipment & Service ETF
- MCHI iShares MSCI China ETF
- $DJICA DJ Islamic market Canada
The list above as well as the timeframes show the lowest timeframes for which a feasible trading system can be constructed. It should further be noted that this list is by no means exhaustive. For example, some non-dollar-based currency cross-rates are predictive of the dollar-based ones. I normally like trading futures because of the leverage and central database. With forex, every forex dealer has its own data. There are also many other indexes and ETFs that are predictive.
Getting quality data is paramount for creating intermarket relationships. One data vendor that I use with TradersStudio and can be imported is Telechart. They are the only vendor that I have found with the complete Morning Star sector database. I use many of these in intermarket systems which are currently being traded. On end of day data, many mutual funds like Fidelity Select funds can be used. Remember also that not just price data works with the intermarket divergence method. Advance-declines, sentiment indices, VIX, and so on all work. Also, many ETFs are also predictive. This is important because there are lots of ETFs which look promising but we only have data for 1-3 years so we can’t use them currently for reliable systems. In the future though, I strongly suspect that many of them will be used extensively in intermarket divergence systems. For example, there are now many different VIX indices for different commodities. Soon these markets will have 10 or more years of data so we will have enough to create a proper system.
Intermarket Divergence System Development Strategies
Because I recognized how challenging it can be to code various intermarket divergence strategies, I developed a simple tool that I am now selling called “Intermarket Divergence Professional”. This version can develop simple (and in this case, note that simple can still be very profitable) intermarket-based systems. Often the performance of two intermarket systems which confirm each other is good enough to trade as a stand-alone system without any other filters. Single intermarket systems are often good enough to trade with some filtering or using a correlation filter. You can test this for the markets you are interested in using Intermarket Divergence Professional. In some cases, a simple one-market intermarket divergence model straight out of the tool is excellent to trade. For example, one such model that comes out really well is our venerable bond-UTY model that we discussed earlier. This happens when you have a very strong intermarket. If you need filters, then often trend filters and correlation filters are valuable in improving the performance of these systems.
There are also more advanced strategies for developing intermarket systems using equity curve feedback. You could use it with a single market of a pair of intermarkets and turn the system on and off. A more advanced concept is to use many different intermarket system combinations and analyze the equity curve for each of them. Then you can implement some form of “voting strategy” such as relative strength to create the entry and exit signals. It’s also valuable to look at the performance on the long and short side separately. A good intermarket system will do well on both.
I am actually in the process of working on a proprietary system that incorporates all of the techniques which we have discussed above. The system uses 5 different intermarkets to trade ES on 45-minute bars, day session only. This system uses equity curve feedback on five different intermarket divergence models. We then implement a voting strategy like we have discussed above. I have coded this system completely in TradeStation EasyLanguage which uses equity curve feedback to enter at the market. My TradeStation system development program for intermarket analysis will allow you to follow my research over the next year within TradeStation for intermarket analysis of intra-day trading models. Our goal is to ultimately develop true day-trading models that are flat overnight. This trading framework can be used to develop trading systems for various markets – ES to gold and crude for forex are just a couple of examples. Members of this new program will share this with me.
The program will start with my current version, fully-disclosed, of my intra-day ES system. This system had its first trade on 09/25/2007 and has produced over $190k in a hypothetical backtest ($115k on the long side, $75k on the short side) with $25 slippage and commission. It also makes almost four times buy-and-hold in this hypothetical example. I have been using this same framework for systems since 2010. You will get all the code for this framework in this program.

Above is a screenshot of the most recent trades that this system has made. Note that the chart goes from May 22, 2015 to June 11, 2015. This means that this chart ends just days before this article was published! Notice how most of the trades line up. A buy is followed by a sell at a higher price and a sell is followed by a buy at a lower price. Also notice how we had a buy signal on June 9, 2015 and was able to sell and be short on June 11, 2015. If you’ll recall on June 12, 2015 the markets went down, meaning that trade would have been right as well! I’m not picking the optimal trade sequence out of many years of data – the chart above shows the most recent backtested trading sequence before this article was published. As mentioned earlier, you can get this system as part of my trading program.
Intermarket Divergence is All About the States
The simple intermarket divergence model uses a zero crossing to define a trend. You might ask, “why don’t you use some threshold to generate a signal?” The truth is we tried that and all our research shows that the zero point is the most significant. That is we don’t need to have some sort of factor that provides confirmation of the trend’s existence. Rather, the most significant and most profitable methodology arises from the fact that the change has occurred. Since the zero crossing is the significant point we can think of it as a switch – uptrend/downtrend. This results in a binary system whereby we can assign a value of “1” to the uptrend and “-1” to the downtrend. Due to this unique property, we can think of it like a state machine as follows: greater than or equals = positive and less than equals negative trend.
For positive correlations we have the following states:
Traded Market | Intermarket | Header |
---|---|---|
1 | 1 | Cell |
-1 | 1 | Buy |
1 | -1 | Sell |
-1 | -1 | Cell |
This produces a switch so that once we have a buy we don’t immediately switch to flat or sell until we actually trigger the sell signal.
For a negative correlation we have the following states:
Traded Market | Intermarket | Header |
---|---|---|
1 | 1 | Sell |
-1 | 1 | Cell |
1 | -1 | Cell |
-1 | -1 | Buy |
Once again, these states ensure that once we have a buy or sell signal, it stays that way until we get the opposite signal. As mentioned earlier, this represents a true state machine.
We have 4 states, two of which create actions. Let’s look at all of these states over the past two bars (a bar in this case need not be a finite time slice but rather the last two state changes that have occurred). This gives us 16 combinations over two time slices. My research shows that these state diagrams over the last two state changes, including the current state, give us a chance to predict how well the current divergence will work. I have found in my research that how you arrived at the current signal is predictive of how well that signal will work. For example, let’s assume we have a positive correlation. Suppose the last state was (-1, -1) – that is both markets are in a downtrend. Consider the following two possible state transitions:
1 (-1,-1)-> (-1,1) Buy
2 ( 1, 1)-> (-1,1) Buy
Notice how both are buy signals. The first transition actually works better than the second transition most of the time. The reason for this is which market is making the change. In the first example, the intermarket is changing, thus indicating that the traded market will likely follow. In the second example, the traded market has changed, but the intermarket has remained constant. This could happen when the relationship has decoupled and is either no longer valid or has entered into an anomalous period. Further study and filters might be needed to determine if this is a good trade or not.
A more advanced area of research of this state paradigm is to add three states to each market. For example, if the market we are trading uses the Close-Average (close, X) function, then we have the sign of this which is the state information discussed earlier. Next we can add two more states, which represent the slope of the price average oscillator. If the value of the slope is increasing it’s state = 1, whereas if it is decreasing then it’s state = -1. In this case we might think of the slope as being like momentum. That is, not only do we want to know the trend in which the markets are, but the momentum at each state change can give us some further insight into generating filters for trades. We do this for both the market we are trading as well as the intermarket. This gives us 16 combinations for each time slice. We can then encode these into a binary number and use that in our analysis. This research is a very promising area of intermarket analysis. There are consistent states which perform differently that are expected. For example, we can get a new buy signal, but the slope information shows this signal has a negative expectation so we can filter it out.
This is a very important area of research for intermarket analysis. The key is to develop state diagrams for 2-3 states back and how intermarket signals perform when coming from different state combinations. In addition, you might also see that the current state could help with exits. For example, with a positive correlation, both the trading market and the intermarket being negative could override an exit of the current position.
Intermarket analysis is a powerful trading method for predicting turning points and trading counter trend. Many different markets can be traded using intermarket analysis. It is very powerful, however the only drawback is the extensive amount of data required. I currently use about $800 worth of data a month to be able to do my intermarket research effectively. Correlation filters, equity curve feedback, multiple intermarket relationships, and state analysis allow you to develop robust intermarket systems. A well designed intermarket system will be robust and will stand the test of time. It will do well for long periods of time and have good performance over time since we can turn off the relationship when it is not working using equity feedback. I plan to share my research in intermarket analysis over the next year or two to my Intermarket Trading System Program for TradeStation clients. I will share open source code as well as relationships I have found to use in real tradable systems.
Indeed, intermarket analysis systems which are counter trend combined with trend following systems in a portfolio of systems are the closest thing I know of to the holy grail!
Download the free Intermarket Divergence tool for TradeStation and MultiCharts by joining the EasyLanguage Mastery newsletter, below.
-- Murray Ruggiero from Using Easylanguage.
I’m a registered member…but where is the source code for this intermarket analysis?
Hello Ben. I just you an email with the link. You’ll also find the link within our weekly newsletter. It’s under EasyLanguage Mastery Insider.
Hey Jeff. I’m having the same issue. I’m sure it’s right in front of me, but I clearly need to go to bed. I’m also registered. Could you email please?
[…] wrote an article for EasyLanguage Mastery by Jeff Swanson where he discussed this relationship and the development of inter-market strategies and through […]