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
| Setting | Default | Range | What it does |
|---|---|---|---|
| length | 20 | 2 to 1000 | Candles in the window. |
| source2 | volume | open, high, low, close, volume, quote_volume, hl2, hlc3, ohlc4, hlcc4 | Second series. |
What it gives
| Output | What it is |
|---|---|
| corr | Correlation, −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