Correlation Coefficient (CC)

From TradingView Wiki
Jump to: navigation, search
Language: English  • 한국어 • Русский


Correlation Coefficient (CC) is used in statistics to measure the correlation between two sets of data. In the trading world, the data sets would be stocks, etf's or any other financial instrument. The correlation between two financial instruments, simply put, is the degree in which they are related. Correlation is based on a scale of 1 to -1. The closer the Correlation Coefficient is to 1, the higher their positive correlation. The instruments will move up and down together. The higher the Correlation efficient is to -1, the more they move in opposite directions. A value at 0 indicates that there is no correlation.

High Positive Correlation


Correlation Coefficient is used not only in finance, but in statistical analysis spanning many different topics. It has been in use for hundreds of years.


The Correlation Coefficient calculation uses Closing Prices. The below example will be made using the Closing Prices over 12 periods for the SPY and JPM:

Numbers may vary slightly due to rounding

All of the necessary data will need to be set up (preferably in a table) which can be done in three steps.

1. First, every period needs to be squared for both securities.


2. Multiply the each period value of SPY by each period of JPM. Notice the last column.


3. Find the Average Value for each column.


Now that all of the data has been properly arranged in a table, the rest of the formula can be completed. This portion can be done in three steps as well.

1. Calculate the Variance for both securities. Variance = Squared Average - (Average Value * Average Value)

SPY Variance: 2.3151

JPM Variance: 1.697

2. Calculate the Covariance of the securities. Covariance = (Average Value of Security1 x Security2) - (Security1 Average Value x Security2 Average Value)

SPY & JPM Covariance = 1.8395

3. Calculate the Correlation Coefficient. Correlation Coefficient = Covariance / SQRT(Security1 Variance x Security2 Variance)

SPY & JPM Correlation Coefficient = 0.9432


Even though The Correlation Coefficient (CC) moves within a band of 1 to -1, it is not considered an oscillator. Values fluctuate between positive and negative correlation, indicating how closely their prices move together. A Correlation Coefficient of +1 is perfect positive correlation and they move in perfect synch. A Correlation Coefficient of -1 is perfect negative correlation and they move in exact opposite directions. Both of these extremes are rare and the Correlation Coefficient will often fluctuate somewhere between the two. Correlation Coefficient of 0 is the middle point indicating that there is currently no correlation between the two instruments.

High Negative Correlation


As opposed to a lot of technical analysis indicators, The Correlation Coefficient is ideal for longer-term investing. If in an investor is going for a truly diversified portfolio, then the Correlation Coefficient can come in quite useful. It can help you determine for diverse the assets in your portfolio are from one another. In other words, by having instruments with low correlation, unnecessary, duplicated risk can be avoided.


As previously mentioned, The Correlation Coefficient can be a useful tool in assembling a diverse portfolio. One thing to always keep in mind however, is the correlation between two instruments can and does change from time to time. This indicator will help the trader to be aware of such changes and alter their investments accordingly.


  1. Navigate to
  2. On the landing page, enter a symbol and click "Launch Chart"
  3. Within the Toolbar along the top of the chart select "Indicators" and choose the one you would like to add to your chart.
  4. To make changes to your Indicator you will need to access the Formatting Window.
  5. You can access the Formatting Window by either clicking on the Blue "Format" button in the Chart Header next to the Indicator name, or by right clicking on the Indicator in the chart itself and selecting "Format".




The second instrument which will then be compared to the original instrument on the chart.


The time period to be used in calculating the correlation. 20 days is the default.


Determines what data from each bar will be used in calculations. Close is the default.




Can toggle the visibility of the Correlation Coefficient as well as the visibility of a price line showing the actual current value of the Correlation Coefficient. Can also select the Correlation Coefficient's color, line thickness and visual style (Area is the Default).



Last Value on Price Scale

Toggles the visibility of Last Values for the Moving Average on the Price Scale.

Arguments in Header

Toggles the visibility of the indicator's name and settings in the upper left hand corner of the chart.


Scales the indicator to either the Right or to the Left.