Five test cases for Correlation studies

Discussions about the testing and simulation of mechanical trading systems using historical data and other methods. Trading Blox Customers should post Trading Blox specific questions in the Customer Support forum.
Post Reply
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2986
Joined: Fri Jun 11, 2004 2:50 pm

Five test cases for Correlation studies

Post by sluggo » Sun Oct 10, 2010 11:09 am

Some traders like to calculate the correlation between instruments in their portfolio, and they use this information to help them manage exposure risk across the portfolio. (Others feel that correlation is misleading hogwash: it goes to hell right when you need it most (LINK) . )

For those who may be thinking about including correlation in the logic of their trading systems, I've attached five test cases to help you debug your code. Each test case is a pair of "instruments" (it might be a pair of stocks, or a pair of futures, or forex, or spreadbets, or CFDs, or ETFs; it really doesn't matter). Each instrument is a price data file, containing about 1.5 years' worth of end-of-day prices, in the standard
  • Open, High, Low, Close, Volume, OpenInterest, UnadjustedClose
format. The five pairs of price files are included in the attached .zip archive: (EX1A, EX1B) is the first pair, (EX2A, EX2B) is the second pair, ... , (EX5A, EX5B) is the fifth pair.

The price files contain Open + High + Low + Close but to reduce clutter, I've only plotted the Close prices in the charts below. You'll see "EX1A.c" in the legend; that is simply the close price of instrument EX1A.

Put these pairs into your software that calculates correlation. TELL IT TO ANALYZE AT LEAST 100 BARS (days) WORTH OF DATA. These test cases contain patterns that are 100 bars long and you need to get the entire pattern into your correlation calculation. Probably the simplest thing to do is to tell your software to analyze the final 200 bars of data. 200 is an easy-to-remember, round number.

You may be aware that there is more than one way to calculate correlation; TradingBlox Builder, for example, provides two ways. So you will need to decide which correlation calculation to use. This is not a simple topic and it often inflames people's emotions (see (THIS) thread on another quant site for an example).

Because I have no idea what YOUR particular goals are when you run correlations, I also have no idea which calculation method is right for your particular application. That means: I don't know "the right answer" for the test cases presented here. It depends on what you are trying to do and how you are trying to do it.

However, I did choose the test cases so they will give wildly different answers ("The Correlation is X!") when you use the two different correlation calculations provided by TradingBlox. I hope this will help to sharpen the differences between the two alternatives, and thereby reassure you that you've chosen the best one for YOUR application.

Have fun with them!
Attachments
Price_Examples_for_Correl.zip
zip archive of five test cases + plots
(128.22 KiB) Downloaded 171 times
panel2.png
The last 2 test cases
panel2.png (20.43 KiB) Viewed 2627 times
panel1.png
The first 3 test cases
panel1.png (31.98 KiB) Viewed 2628 times

ecritt
Roundtable Knight
Roundtable Knight
Posts: 134
Joined: Sat Aug 28, 2004 3:44 am
Location: Phoenix, AZ
Contact:

Post by ecritt » Sun Oct 10, 2010 6:47 pm

Nice work. The panel 2 exhibits illustrate why I do not reward a "lack" of correlation. It simply does not convey the information that people think it does. An excellent book on the history and origins of correlation:

http://www.amazon.com/Lady-Tasting-Tea- ... 0716741067

LeviF
Roundtable Knight
Roundtable Knight
Posts: 1428
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post by LeviF » Sun Oct 10, 2010 9:51 pm

Maybe this is why I have found limited value in correlation studies.

hvollmeier
Full Member
Full Member
Posts: 14
Joined: Tue Apr 24, 2007 8:32 am
Location: Cadiz, Spain

Post by hvollmeier » Wed Oct 13, 2010 11:25 am

<This is not a simple topic and it often inflames people's emotions ...

Frankly, I don't think there is an argument within the professional investment community of either using price or return to compute correlations. We are interested in risk vs. RETURN and not price.
Assuming a price change of 1$ - does it make a difference if the price series ( underlying market ) is based on a level of 5$ or 100$ ?
Correlations computed on price series ( as well as on returns on backadjusted series ) are useless and a waste of time. Risk management is tied to a return framework and not to absolute prices. :)

Post Reply