← Script Marketplace
Open-source scriptindicator/v1

Correlation Coefficient

by Kodexius·@kodexius·

Measure the rolling linear relationship between two chart data series.

#correlation#oscillator#statistics
Correlation Coefficient chart preview

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
Release notes

Initial classic indicator release.

View current source ↓
Source codempl-2.0View 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

Loading…

No comments yet. Start the discussion.