Intermarket Analysis module - ten years later...

written by Sergey Tarassov

Introduction

This is a module with some history. It has been created 10 years ago (in 2009). Originally it was designed more as a research tool. The module was described in this article: http://www.timingsolution.com/TS/Programs/pr/#A100

Then I have received lots of notes and wishes regarding this module. As a result, many new features have been incorporated there, and now a new version of this module is released.

General idea description for busy people

This is ...

 

How it works

It is better to explain how this module works showing some practical example. Let us do it together.

 For the analysis we have downloaded SNP500 since 1950. Our goal is to make a forecast for SNP500 using methods of intermarket analysis. So, to conduct intermarket analysis,  we should download data for some other financial instrument or instruments, and we will look how these financial instruments (including SNP500) work together. To choose financial instruments for intermarket analysis, we may use any information (books, courses, etc.) Let us consider the idea that T-bonds are a leading indicator for stocks, and its effect is different at high and low interest rates. We can easily investigate this phenomenon with the new Intermarket module of Timing Solution software.

After downloading SNP500 index in the Main screen, let us run Intermarket module. It is in "Pattern" section. Click "+" button there to download a financial instrument that will be used for intermarket analysis:

 

 

A standard for Timing Solution dialog box appears. There we are able to download price history from different sources: files, clipboard, Yahoo and Quandl services, eSignal, etc.

As an example, I use the data from free service https://www.investing.com . This service allows to load price history into Excel. We do that  for 30 years US T-Bonds and copy downloaded price history into the clipboard. When it is done, we download this price history data into Timing Solution by clicking "from Clipboard":

 

To confirm downloading, click "Load" and "OK" buttons:

 

The same manner applies to downloading price history from some file or Internet using Yahoo/eSignal/Quand services. To do that, please use this button:

This is a standard procedure in Timing Solution; it is explained in this class: http://www.timingsolution.com/Doc/level_1/2.htm

Often data sources do not provide price history more than for a certain amount of years. It means that we should download price history from different sources covering different time intervals. In this case instead of using "Load" button click "Update" button: new pieces of price data will be added to already downloaded price history.

When it is done (data are downloaded for both, SNP500 and T-bonds) in Intermarket module window we can see a panel  for T-Bonds. The controls there allow to conduct intermarket analysis for T-Bonds versus SNP500:

 

 

It is recommended to type there the name of a downloaded financial instrument, it serves as a reminder.

Look at the Main screen now:

 

There is a chart there for downloaded SNP500 index, a red curve that represents US T bonds and a red diagram in the bottom panel that shows US Fed rates history.

To disable US Fed rates information, set OFF "Display Fundamentals" in "More" tab:

 

A first glance: the correlation chart

Is there any correlation between these financial instruments? Usually researchers display both charts (SNP and T bonds in our example) and watch how they move together. Charts are considered  correlated - if they show approximately the same movement, i.e. if one instrument goes up, another instrument shows up movement as well and vise versa. They are anti correlated - if they show opposite movement, i.e. if one goes up while another goes down and vise versa. Such visual analysis can be done by zooming the price chart and watching a mutual behavior of these two charts (SNP500 and T-Bonds in the example). However, to see the whole picture we should conduct a more formal analysis.

To research a correlation between SNP500 and T-Bonds, click this button and in pop-up menu choose "Historical correlation" item:

 

In a moment the correlation chart appears:

 

The red periods there show dates when SNP500 and T-Bonds are correlated in a positive way, i.e. when they move in the same direction. Blue zones show anti correlated periods i.e. dates when these financial instruments move in opposite direction.

In this example SNP500 and T-Bonds correlated positively till 1999; this is a period of high FED rates mostly. Since 1999 we have the opposite picture: SNP500 and T-Bonds correlate in a negative way, and rates were mostly low.

 The brighter zones there correspond to higher correlation/anti correlation. Moving a mouse cursor through the correlation chart, we can see the degree of this correlation/anti correlation for different dates:

 

 

The diagram below shows that in the middle of  2013 SNP500 and T-Bonds mostly moved in opposite way (inverted similarity), and the correlation is high negative -81%.

This is the price chart for this period:

 

Playing with Lag - the main forecasting tool 

The main goal of intermarket analysis is to find a leading indicator - the indicator that moves ahead, providing some useful tips regarding possible future movements. We have already tried to find a correlation between two different markets (charts, financial instruments). When a direct comparison does not work, we may try working with shifted charts. This approach has a significant advantage: if we find a lag, it means that we have some time to be prepared for the next market move.

Look at this example. There we have shifted forward T-Bonds chart on 100 calendar days, the lag = 100 days:

 

 

We may change lag values to find a better correlation between the researched financial instrument (SNP500 in our case) and the shifted chart (T-Bonds) . What lag is better for forecasting -10, 50, ..20 days - or some other lag? Let me say from the very beginning: there are no rules here that work forever (that is always in finance, no surprise here). However, applying different mathematical approaches, it is possible to get the best lag, and below you will find the description of these techniques.

Before going further, some definitions must be considered.

The research of the relations between a financial instrument that we consider as a leading indicator (2) to the financial instrument whose behavior we would like to forecast (1) is called as "2 versus 1". These numbers, 1 and 2, relate in the program to the download routine. In our example, 1 relates to SNP500 and 2 relates to T-Bonds. We consider T-Bonds being a leading indicator to SNP500. So, we would research "T-Bonds versus SNP500".

Analyzed interval (order) - pay attention to this parameter. It is the time interval where the program calculates a correlation for assumed leading indicator versus the financial instrument whose behavior we would like to forecast. In our example, it is the interval where the program calculates a correlation for T-Bonds versus SNP500. By default it is set to 250 bars:

 

The program calculates a fitness between these two financial instruments within the last year (as the last 250 bars of EOD chart make about 1 calendar year):

 We have the  negative correlation here = -19.4%, so these instruments are more inverted.

Now shift T-Bonds price chart one calendar day ahead and watch how the fitness between SNP500 (last 250 bars) and the shifted T-Bonds chart has changed.

The correlation now is -16.6%. Then let us do 2 days shift. The correlation=-15.1%.  And so on...

 

To get a full picture of how the correlation for shifted T-Bonds  versus SNP500 changes with a change of a lag, do this:

 

 

The diagram appears that shows how the correlation for shifted T-Bonds  versus SNP500 varies while we change the lag:

shifted

 

The diagram above shows that at lag=47 days the correlation reaches its maximum value about 30%.

To simplify this procedure, make a mouse click around the peak on this diagram. The program automatically will set the lag for this peak (47 days) and will calculate the correlation (31.8%):

 

 

Accordingly in the Main screen  this 47 calendar days shifted T-Bonds chart will be shown, and this information may be used as a forecast for SNP500:

 

 

You can also use "Optimize" button

It will calculate the best lags to choose any of them:

Reminder - when you use a lag with a negative correlation it means that SNP500 and shifted T-Bonds charts are inverted. In this case it would be better to invert the intermarket chart:

Or at least you should remember about the inversion.

 

One more feature to play with lag. You can vary the lag by dragging the price chart with the mouse. In order to do that, click this button:

 

When you click this button the very first time, the eye image will appear on the button , as well as time and price scales for T-Bonds. 

 

 

 

Click this button once again, and yellow arrow image will appear on it:

Now you can shift the T-Bonds chart by dragging the mouse cursor. While you drag this chart, the lag value and the correlation vary as well.

This button works in three modes: no image - the standard mode, eye image - displays time and price scale for the compared instrument and arrow image - allows to drag its chart manually.

More interface features for your convenience:

Color/thickness: click on this button to change the color or thickness of the chart:

 

Use: The program is able to conduct intermarket analysis comparing many financial instruments at once. In this case it is useful to hide some charts from the screen, it can be done with "use" option:

 

Inverted chart: to invert the price chart, use this option:

Here are examples of two charts:

normal view

inverted

 

Updating price history

Updating: to update the existing price history, click "Update" button:

Pay attention to a panel "since...till"; there you can see always the downloaded interval.

Source: clicking this small "S" button, you may store some custom information regarding the source of downloaded price history data.for this financial instrument:

 

For your convenience, if this is some Internet source, you can open its website right here, by clicking "WWW" button:

In this particular case the crude oil price history has been downloaded from the website www.investing.com. To update the price history, click "WWW" button. You get the page with the latest price history:

 

Then click "Download Data" button there to get Excel file with this data:

To move this information from Excel to Timing Solution, we need to put it into the clipboard. We do that clicking Ctrl-A to select all data in this Excel table and then clicking Ctrl-C to put this data into the clipboard (another way is to do the right mouse click over selected data and then choose "Copy" in the popup menu). Now the latest price history from investing.com is in the clipboard; we are ready to update the existing price history in Intermarket module.

Click "Update" button:

 

Click "from Clipboard" button to paste this data (1), click "Load" button to download this piece of price history from clipboard into Timing Solution (2). Look at the bottom of this window, to be sure that downloaded data is Ok (3) and click "Ok" button to confirm this procedure (4):

Sometimes when you click "WWW" button this message appears:

 

It means that you probably need to log to the website. In this case, simply run your data source website (as an example, https://www.investing.com/) and enter there your login information. After that you can click "WWW" as many times as you need.

 

Your data source might be Yahoo financial service; you get something like this:

 

 

Clicking "WWW" button, you get this information, the price history, in JSON format:

 

Simply put all this information into clipboard as it is explained in the previous example and then paste it into Timing Solution (and click "Load" and after that click "Ok"):

 

The program automatically recognizes Yahoo JSON format.

Here is the video with short explanation how to update the price history:

intermaket_updating_price.mp4

Intermarket Lag Chart (ILC) (available under Terra Incognita project of Timing Solution)

 To run ILC, do this:

 

This module takes some time for calculation. It analyses all available price history trying to reveal leading and lagging indicators.

This is how ILC chart for T Bonds looks:

 

You need to watch here the highest peak. In the example it is in the left upper side. The left side means that T-Bonds is leading indicator for SNP500. The upper part/zone means that this is normal, not inverted indicator.

The peak here corresponds to the lag=210 calendar days. Clicking a mouse button around this peak sets this lag value in the program:

 

 

In the Main screen the corresponding shifted forward on 210 days T-Bonds chart will appear. Because T-Bonds is a leading indicator, it can be used for forecasting future SNP500 moves. The forecast power of this leading indicator is 18%, not bad. This is an averaged correlation between analyzed and lagged charts.

Here is an example of the inverted leading indicator; this is ILC for Dollar Index versus SNP500:

 

Dollar index is the inverted leading indicator for SNP500 with the lag of 156 calendar days. The same indicator can be considered as lagging with the lag=76 days.

This information can be read this way: a lowering dollar index drives the stock market with the lag of 156 days (leading anti-correlation). And when the stock market is getting higher, the dollar index is getting higher as well with the lag of 72 days (a lagging correlation). The same indicator here plays a role of leading and lagging indicator, it shows the phases of some business cycle. However, the forecast power for this indicator is not high: accordingly 8 and 10%, i.e. the averaged correlation for this index is  -8% (minus because it is inverted) and 10%.

You can conduct more advanced research. Try another example: calculating ILC for the period of super low interest rates (2009-2016). When you run ILC chart, the program shows this box where you may specify parameters for ILC chart:

You can specify the analyzed interval there (if this box is empty, program analyses all available price history). This is how ILC T-Bond vs SNP500 for super low rates period looks:

The new strong peak with Lag=0 appeared. It means that when FED rates are low, we have a strong anti-correlation between T-Bonds and SNP500. If we calculate ILC for the period of high rates, we get the opposite picture: a strong positive peak around zero lag, i.e. the strong correlation between T-Bonds and SNP500.  Pay attention, at the same time 210 days shifted chart can be used as a leading indicator for SNP500.

 

More about interface: you can create as many intermarket charts as you need. In this example below we have downloaded T-Bonds, two commodity indexes and Dollar index. Now we decided to remove one commodity index. In order to do that we set this index as not USED:

 

After that click "-' button and in pop-up menu choose the first option:

 

Intermarket templates: in a real life, you probably will use the same set of intermarket financial instruments and apply these intermaket instruments for the instruments you trade. You can save your intermarket model as a template and later open it and apply for any financial instrument you trade. In order to do that use these buttons:

 

January 10, 2019

Toronto, Canada