This shows you the differences between two versions of the page.

— |
technical_indicators:correlation_coeffici [2019/06/24 19:38] (current) |
||
---|---|---|---|

Line 1: | Line 1: | ||

+ | ====== Correlation Coefficient ====== | ||

+ | ===== Introduction ===== | ||

+ | |||

+ | The Correlation Coefficient is a statistical measure that reflects the correlation between two securities. In other words, this statistic tells us how closely one security is related to the other. The Correlation Coefficient is positive when both securities move in the same direction (up or down) and negative when the two securities move in opposite directions. Determining the relationship between two securities is useful for analyzing intermarket relationships, sector-stock relationships and sector-market relationships. This indicator can also help investors diversify by identifying securities with a low or negative correlation to the stock market. | ||

+ | |||

+ | ===== Calculation ===== | ||

+ | |||

+ | The calculation for the Correlation Coefficient is rather complicated, so feel free to skip this section. We will simply look at the basics to see some of the method behind the madness. This indicator is right at the heart of classical statistics. The first step is to select two securities. In this example, we will be using Intel (INTC) and the Nasdaq 100 ETF (QQQ). Namely, we want to see the degree of correlation between Intel and QQQ. The Excel table below lays out the groundwork. | ||

+ | |||

+ | {{:technical_indicators:correlation_coeffici:ccoe-01-excel.png|Correlation Coefficient - Excel Example}} | ||

+ | |||

+ | * The INTC column shows Intel prices over a 20 day period with an average at the bottom. | ||

+ | * The QQQ column shows the same for QQQ. | ||

+ | * The next two columns show each period's price squared with the average at the bottom. | ||

+ | * The last columns show INTC multiplied by QQQ for each period with an average at the bottom. | ||

+ | |||

+ | Using the bottom row, we can now compute the Variance, Covariance and Correlation Coefficient. The Excel formula is shown alongside the long formula. As seen above, Intel showed a strong positive correlation (+.95) with the Nasdaq 100 ETF over the 20-day period. | ||

+ | |||

+ | {{:technical_indicators:correlation_coeffici:ccoe-02-intcexam.png|Correlation Coefficient - Intel}} | ||

+ | |||

+ | Here's {{:technical_indicators:correlation_coeffici:cs-corrcoef.xls?linkonly|an Excel Spreadsheet}} that shows the Correlation Coefficient in action. Some numbers may differ slightly due to rounding issues. | ||

+ | |||

+ | ===== Interpretation ===== | ||

+ | |||

+ | The Correlation Coefficient oscillates between -1 and +1. It is not a momentum oscillator, however. Instead, it moves from periods of positive correlation to periods of negative correlation. +1 is considered perfect positive correlation, which is rare. Anything between 0 and +1 indicates that two securities move in the same direction. The degree of positive correlation is likely to vary over time. Oil stocks and oil are positively correlated most of the time. The example below shows the Energy SPDR (XLE) with Spot Light Crude ($WTIC). Unsurprisingly, the 20-day Correlation Coefficient remains largely positive with regular forays above +.75. There is clearly a positive relationship between these two securities. In general, anything above .50 shows a strong positive correlation. | ||

+ | |||

+ | {{:technical_indicators:correlation_coeffici:ccoe-03-xlewtic.png|Correlation Coefficient - Oil and Oil Stocks}} | ||

+ | |||

+ | At the other end of the spectrum, -1 is considered perfect negative correlation, which is rare. Anything between 0 and -1 indicates that two securities move in opposite directions. The degree of negative correlation is likely to vary over time. Gold and the Dollar are the first two securities that come to mind for a negative correlation. The chart below shows Spot Gold Spot ($GOLD) with the US Dollar Index ($USD). Although the Correlation Coefficient spends a fair amount of time in positive territory, it is negative the majority of the time. In general, anything below -.50 shows a strong negative correlation. | ||

+ | |||

+ | {{:technical_indicators:correlation_coeffici:ccoe-04-goldusd.png|Correlation Coefficient - Gold and Dollar}} | ||

+ | |||

+ | ===== Diversification ===== | ||

+ | |||

+ | The Correlation Coefficient can be used to identify non-correlated securities, which is important in developing a diversified portfolio. Unsurprisingly, the nine S&P sectors are mostly positively correlated with the S&P 500. However, some are more positively correlated than others. For example, the Technology ETF (XLK) and the Consumer Discretionary SPDR (XLY) have a strong positive correlation with the S&P 500 over the last three years. The Correlation Coefficients below are based on 50 days. The consumer discretionary sector dipped below .50 only once in the last three years. The technology sector never dipped below .50 as techs remained strongly correlated to the market. In contrast, the Correlation Coefficient for the consumer staples sector dipped below .50 a few times and the Correlation Coefficient for the utilities sector even dipped below zero twice. This indicator shows us that the consumer staples and utilities sectors are less correlated to the S&P 500 than the consumer discretionary and technology sectors. | ||

+ | |||

+ | {{:technical_indicators:correlation_coeffici:ccoe-05-sectors.png|Correlation Coefficient - Sectors}} | ||

+ | |||

+ | In order to truly diversify from stocks, it is often necessary to look outside of the stock market. The chart below shows four ETFs that have many periods of negative correlation with the stock market (SPY). Notice how the Correlation Coefficients dip below zero numerous times. In this example, I am also using the 50-day Correlation Coefficient. The 20+ year Bond ETF (TLT) represents bonds, which are negatively correlated with stocks most of the time. Gold (red) moves between periods of positive and negative correlation. On the whole, it has been more positively correlated than negative the last three years. The Yen Trust (green) appears to split its time between periods of positive and negative correlation. Surprisingly, the US Dollar Fund (UUP) shows a propensity to be negatively correlated with the stock market. | ||

+ | |||

+ | {{:technical_indicators:correlation_coeffici:ccoe-06-diversify.png|Correlation Coefficient - Other Assets}} | ||

+ | |||

+ | ===== Conclusion ===== | ||

+ | |||

+ | The Correlation Coefficient tells us the relationship between two securities. Over a given time period, the two securities move together when the Correlation Coefficient is positive. Conversely, the two securities move in opposite directions when the Correlation Coefficient is negative. The examples above show 20-day and 50-day Correlation Coefficients. Longer-term investors may use 150 or even 250 days (one year) for smoother lines that reflect longer-term relationships. | ||

+ | |||

+ | ===== Using with SharpCharts ===== | ||

+ | |||

+ | The Correlation Coefficient is available in SharpCharts under "indicators." First, create a chart with the base security entered in the symbol box at the top of the chart (INTC). Second, select Correlation as an indicator in the drop-down menu. Third, enter the symbol for the other security and the timeframe in the parameters box ($SPX,10). These two are separated by a comma. The example below shows Intel in the main window with the 10-day Correlation Coefficient in the indicator window. This shows how Intel correlates to the S&P 500. Also, notice that the S&P 500 price plot (red dashed) is placed behind the Intel price plot for comparison. [[https://stockcharts.com/h-sc/ui?s=INTC&p=D&b=5&g=0&id=p82568512106|Click here]] for a live chart with the Correlation Coefficient. | ||

+ | |||

+ | {{:technical_indicators:correlation_coeffici:ccoe-07-intcshch.png|Correlation Coefficient - Intel SharpCharts}} | ||

+ | |||

+ | {{:technical_indicators:correlation_coeffici:ccoe-08-shch.png|Correlation Coefficient - SharpCharts}} | ||

+ | |||

+ | ===== Suggested Scans ===== | ||

+ | |||

+ | ==== Portfolio Diversification ==== | ||

+ | This scan reveals ETFs that are inversely correlated (moving in the opposite direction of) the S&P 500 index. This can be useful for diversifying an investment portfolio. The first clause limits the scan results to ETFs, excluding ultra and inverse ETFs. The second clause looks for those ETFs that have a negative correlation with $SPX over the last 200 trading days. | ||

+ | <code> | ||

+ | [group is ETFNOUI] | ||

+ | AND [Correlation(200,$SPX) < 0] | ||

+ | RANK BY [Correlation(200,$SPX)] | ||

+ | </code> | ||

+ | |||

+ | For more details on the syntax to use for Correlation scans, please see our [[docs>scans:indicators#correlation_coefficient|Scanning Indicator Reference]] in the Support Center. |