- Desktop
- Scripting
- Formulas and Scripting Functions
- Correlation Function - CRL()
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.

Your privacy choices
We use cookies and similar technologies to make the site work, see how it's used, and improve it. Analytics and advertising cookies only run with your consent — see our Privacy Policy for details.