Correlation

How closely price moves with another candle series, such as volume, from -1 to 1.

Pearson correlation between the source (a price) and source2 (any candle series, default volume) over the last length candles (current included), −1 to 1. Not ready while either window is flat. Mirror: signed (a mirrored price against an unchanged series such as volume turns the correlation around).

Settings

SettingDefaultRangeWhat it does
length202 to 1000Candles in the window.
source2volumeopen, high, low, close, volume, quote_volume, hl2, hlc3, ohlc4, hlcc4Second series.

What it gives

OutputWhat it is
corrCorrelation, −1–1.

What it reads

It reads open, high, low, close, hl2, hlc3, ohlc4, hlcc4, close by default.

Warm-up

With its default settings, Correlation needs 20 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.

Test it

Copy this sentence into the Algonney chat to backtest it:

Backtest a strategy on BTC that uses Correlation with its default settings