OPEN-SOURCE SCRIPT

BTC vs Altcoin Correlation

This Pine Script indicator calculates and visualizes the rolling correlation between Bitcoin (BTC) and a selected altcoin, while providing insights into the percentage of time the correlation remains above a user-defined threshold. Users can independently configure the correlation calculation period and the lookback period for measuring the percentage of time above the threshold. The correlation is displayed as a color-coded line: green when above the threshold and red otherwise, with a dashed horizontal line marking the threshold level. A dynamic table displays the current correlation value and the percentage of time spent above the threshold within the specified period, enabling quick evaluation of correlation dynamics between BTC and the chosen altcoin.
OscillatorsPine utilitiesstatistics

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer