Various tools can be used to define an up or downtrend. The moving average works well. One way to define a trend would be the sign of price relative to a selected moving average length. The traded market and lead market can have different length moving averages. The code for a system based on this concept is shown in "Developing in divergence" (below).
Click here to access this code as text.
As an exercise, let’s apply our model to the Treasury data set. Because we are looking for divergence, we only will make trades near market turning points based on our perfect data. When optimizing, we found the best set of parameters is 1, 1, 5 and 10. This is a 2.5-day lag for the Treasury bonds and a five-day lag for our shifted five-day forward series. Our Close-Average(Close,X,0) is close minus a closing price centered X/2 days ago.
In our fantasy world, we would make $1,884,968.75. More important, though, is that we still would lose on a few trades. The winning percent is 92%. This demonstrates that the theory is not perfect. The reasons are auto-correlation within the bond series and the changing lengths of market moves.
Unfortunately, we don’t have a perfect intermarket signal with a consistent lead. The best we can hope for is a market that leads somewhat consistently most of the time.
One example can be found with T-bonds and utility stocks based on the UTY Index.
We’ll use an eight-period moving average for T-bonds and an 18-period moving average for UTY. The eight-period moving average produces four days of lag and the 18-period moving average has nine days of lag. We are looking at a five-bar difference between the center four-bar shift for Treasuries and nine bars for UTY, so we imply a five-bar lead for Treasuries. This is effectively the shift. Results are shown in "Shift results" (below).
Utility stocks aren’t the only effective intermarket partner to Treasuries. Silver, which is negatively correlated, is another good candidate. T-bonds are a rich source of intermarket strategies, but the usefulness of this approach doesn’t stop there. Valuable relationships can be found in energies, live cattle and metals.