Correlation Matrix by Sammy_G

Correlation Matrix

This is a study to calculate and display the correlations of all dataset symbols as of last bar; it is not a trading strategy. To get the correlation value of a symbol pair, locate the cell at the intersection of the vertical column and horizontal row representing the two symbols and read the value.

Requires installed Community.Components and Community.Indicators libraries.

How to use this strategy:

- Use daily bars
- Data Range: should at least equal the correlation period; if less, or if the clicked symbol has less data, the correlation will be calculated for this shorter period; also, for any symbol pair, the correlation period is automatically set to the lower of the correlation period & whichever symbol has the shorter history (i.e. only actual bars, not synthetic bars, are used) [** see note below]
- Since it loops through the entire dataset, click on only one symbol to run the strategy (choose a symbol with history at least equal to the correlation period)
- To get the most accurate results, use of dividend-adjusted prices (e.g. from Yahoo) is recommended
- Make sure the data is updated; remove non-trading symbols from the dataset, if necessary

Users have the following choices:

- Correlation period: Choose the period for calculating the correlation; default is 252 which equals one year (assuming daily bars)
- Colored table: Choose whether or not to display the table with colored background for cells; default is to use color
- Correlation method: Choose which method to use for calculating correlation; log-normal returns (default) is preferred but if this is not desired, or is causing errors, set the boolean value to false to calculate using prices

[** To avoid errors or NaN values when using the LNRet method, its best if the correlation period is not set higher than the shortest data history of any symbol in the dataset]

Author: Sammy_G
Category: Utilities
Creation Date: 3/4/2011
Licence: Freeware
Availability: Globally
Instructions for Script Download
  1. In Wealth-Lab client software, open the Strategy Explorer (Ctrl+O)
  2. Click the "Download..." button
  3. Click "Begin Download"
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).