Price and Indicator Correlation

Confirming Indicator Validity: By calculating the correlation coefficient between the price and a specific indicator, you can assess the degree to which the indicator and price move together. If there is a high positive correlation, it suggests that the indicator tends to move in the same direction as the price, increasing confidence in the indicator's validity. On the other hand, a low or negative correlation may indicate a weaker relationship between the indicator and price, signaling caution in relying solely on that indicator for trading decisions.

Identifying Divergence: Divergence occurs when the price and the indicator move in opposite directions. By monitoring the correlation coefficient, you can identify periods of divergence between the price and the selected indicator. Divergence may signal a potential reversal or significant price move, providing an opportunity to enter or exit trades.

Enhancing Trading Strategies: The correlation coefficient can be used to enhance trading strategies by incorporating the relationship between the price and the indicator. For example, if the correlation coefficient consistently shows a strong positive correlation, you may use the indicator as a confirmation tool for price-based trading signals. Conversely, if the correlation is consistently negative, it may indicate an inverse relationship that could be used for contrarian trading strategies.

Indicator Optimization: The correlation coefficient can help traders compare the effectiveness of different indicators. By calculating the correlation coefficient for multiple indicators against the price, you can identify which indicators have a stronger or weaker relationship with price movements. This information can guide the selection and optimization of indicators in your trading strategy.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?