Open-source scriptindicator/v1
Correlation Coefficient
Measure the rolling linear relationship between two chart data series.
#correlation#oscillator#statistics
Description
The Correlation Coefficient ranges from -1 to 1. Values near 1 indicate that the selected series tend to move together, values near -1 indicate opposing movement, and values near zero indicate a weak linear relationship.
Open-source script. Everyone can inspect the source code, use the script on a chart, and save an editable copy.
Release notes
Version history · 1 published version
Version 1CurrentChart updatedCorrelation Coefficient · Aug 31, 2026
Source codempl-2.0View sourceHide source
indicator("Correlation Coefficient", { overlay: false });
const length = input.int("Length", 20, { min: 2, max: 500 });
const first = input.source("First Source", "close");
const second = input.source("Second Source", "volume");
plot(correlation(first, second, length), { title: "Correlation", color: "#2962ff", lineWidth: 2 });
hline(0, { title: "Zero", color: "#78909c", style: "dotted" });
Community discussion
0 comments
No comments yet. Start the discussion.