Correlation
Indicator
The correlation coefficient is the Pearson r of the close against time over the last 20 bars, from -1 to 1, showing how straight the recent trend has been.
Karl Pearson, 1896. Reviewed by the ChartLabs team, updated Nov 2026.
Correlation Coefficient is -0.958.
Correlation Coefficient -0.958
Correlation Coefficient is -0.958.
Correlation Coefficient -0.958
Illustration on simulated data.
Correlation coefficientWhat is the Correlation indicator?
Each bar, the indicator fits a straight line to the last 20 closes and reports how tight that fit is. The number is Pearson's r, not the slope and not a forecast. A perfect rise reads 1. A perfect fall reads -1. A flat window has no r, so the line is empty rather than zero.
Closes 1 through 20 are a perfect rise, so r is 1 on the bar where the 20th close arrives (record 19). Twenty closes of 5 have no variation, so r is empty. The length can be as short as 2. Until 20 closes exist, the value is empty.
The source defaults to the close. The line is blue #2196F3, 2 px, in its own panel, with 3 decimals. There is no second symbol: the correlation is with time, the bar number, not with another market.
Empty until 20
r needs a full window. Records before the length are empty, not zero.
With time, not with another symbol
There is no second instrument input. The x-axis of the fit is the bar count.
Correlation signalsFive patterns to know.
Near 1
The last 20 closes lie close to a rising straight line.
Near -1
The last 20 closes lie close to a falling straight line.
Near 0
The closes have little linear relationship with time. A bend or a chop both do this.
No value
The window is not full yet, or every close in it is the same.
Falling off 1
A rise that had been straight is bending. r drops before the slope has to change sign.
Correlation formulaHow it is calculated.
Take the window
Use the last 20 closes. Before that, leave the line empty.
Fit time
Compare those closes with the bar numbers 0 through 19 inside the window.
Read r
A rise of 1, 2, 3 and on through 20 gives r of 1. Twenty equal closes give no r.
Correlation settingsEvery setting, explained.
| Setting | Default | Range | What it changes |
|---|---|---|---|
| Length | 20 | 2 to 5,000 | How many closes are in the fit. The Signal lens changes this. |
| Source | Close | Any price, or volume | The series correlated with time. |
| Line | Blue #2196F3, 2 px | Fixed | One line, 3 decimals, in its own panel. |
- Setting
- Length
- Default
- 20
- Range
- 2 to 5,000
- What it changes
- How many closes are in the fit. The Signal lens changes this.
- Setting
- Source
- Default
- Close
- Range
- Any price, or volume
- What it changes
- The series correlated with time.
- Setting
- Line
- Default
- Blue #2196F3, 2 px
- Range
- Fixed
- What it changes
- One line, 3 decimals, in its own panel.
Drag to see how the setting changes the lines and how many signals you get. Illustration on simulated data.
Correlation strategiesUse it in 3 setups.
A high r with the trend
The recent closes have been a clean rise. Traders often want that before they treat a breakout as orderly.
r peeling off the extreme
Price may still be up. The closes are no longer in a straight line.
Ignore the warm-up
An empty line is not a zero, and it is not a signal.
Correlation mistakesCommon mistakes.
Reading r as a slope
r of 1 says the rise is straight. It does not say how many points per bar. A shallow line can also read 1.
Calling 0 a reversal
Near 0 means the window is not a straight line. It can be a range, a curve, or a mix.
Treating a flat market as r of 0
If every close is equal, r is undefined and the line is empty.
Correlation combinationsPair it with these.
Correlation + Least Squares Moving Average
That overlay is the fitted line in price. This panel is only the correlation of that kind of fit.
Correlation + Linear Regression Slope
The slope says how steep the fit is. r says how well the closes follow it.
Correlation + RSI
RSI is about up-closes versus down-closes. r is about how straight the last 20 closes have been.
Correlation + EMA
The EMA is a price average. r says whether the recent path was linear.
Correlation FAQQuestions traders ask.
What are the correlation settings?
Length 20 and source close. There is no second symbol.
What does 1 mean?
The closes in the window sit on a rising straight line. Closes 1 through 20 give r of 1.
What does -1 mean?
They sit on a falling straight line. A countdown from 20 down to 1 also gives r of -1.
Why is the line empty?
Either the chart has fewer than 20 closes, or every close in the window is the same. A flat window is empty, not zero.
Is this correlation with another market?
No. It is correlation of the source with time, the position of the bar inside the window.
Does a shorter length help?
A shorter window reaches 1 and -1 more often, because fewer closes have to line up. The default is 20.
Does it repaint?
No. A closed bar's r stays. The live bar moves until it closes, because that close is inside the window.
Who defined r?
Karl Pearson, in a paper on correlation for the Royal Society, 1896. The indicator is that r, applied to a moving window of closes.
Related indicatorsMore statistical tools.
All statistical indicatorsTry Correlation on a live chart.
Free. No download.
Works in your browser and on iPhone too.