Historical Correlation
By LuxAlgoMar 14, 2024
Historical Correlation is an indicator on Vela, our next-generation charting platform, written in Pine Script®.

Historical Correlation tracks the correlation coefficient (the −1 to +1 measure of how faithfully two assets move in step) for up to 10 user-defined ticker pairs, starting from an anchor point you confirm by clicking a bar or picking a date in the settings. Two displays cover the two questions traders ask: LINES mode plots each pair's coefficient evolving through time, while HEATMAP mode renders the most recent values as a color-graded snapshot.
How to Trade the Historical Correlation?
- Readings near +1: the pair moves in sync. Divergences between two tightly correlated assets are the raw material of pair trading.
- Readings near −1: the pair moves inversely, which is what a hedge is made of: long one, and the other tends to offset it.
- Readings near 0: independent movement, the property diversification depends on, and a warning when two supposedly different holdings sit near +1 instead.
Sector rotation work benefits from the same data, since watching how sector and market-wide correlations shift can reveal which groups are decoupling. The anchored design matters here: relationships drift, and the tool shows exactly how they have evolved since the point in time you care about.
Historical Correlation Settings
- Anchor Point: the bar the calculation starts from.
- Anchor Period: NONE, HOURLY, DAILY, WEEKLY, MONTHLY, QUARTERLY, or YEARLY. With NONE the calculation never resets; any other choice restarts it at each new period's first bar.
- Ticker Pairs (1-10): choose each pair, toggle its visibility, and color-code it.
- Drawing Mode: LINES for historical plots, HEATMAP for the current snapshot.
Frequently Asked Questions
Free to use
Run it on Vela. Go further with a paid plan.
- Up to 500 Custom Alerts, with webhook automation
- Up to 10× the chart history of Free
- Orderflow lookback up to full history
- More Quant usage to customize it, plus extra usage when you need it
- Futures data alongside crypto, stocks, forex and commodities
Also works on
Related indicators
All 9 Correlation indicatorsRun it on Vela. Make it yours with Quant.
Open this indicator free on Vela, our next-generation charting platform. Then ask Quant, our coding agent built into Vela, to retune it or turn it into a backtested strategy of your own.



