Correlation Function - CRL()
To calculate correlations between a stocks, asset classes or sectors use the CRL()
function.
For example, to show the 22 day correlation between the S&P500 index and various asset classes use the following in a watchlist with the GETDATA() function to use the SPX data:
S1 = GETDATA(CODE=SPX:WI);
C1 = CLOSE();
CRL(C1, S1, BARS=22)
By default it will calculate based on % change, but it can also be calculated on price change.