YoavShachak

Symbols Correlation, built for pair trading

Overview:
This script is designed for pairs trading. If you are not familiar with pairs trading, I suggest learning about it, as it can be a profitable strategy in neutral markets (or neutral trends between two assets). The correlation between two assets is the foundation of pairs trading, and without it, the chances of making a profit are low.
Correlation can be described in two opposite ways:
  • 1: Absolute positive correlation (meaning the asset prices move together).
  • -1: Absolute negative correlation (meaning the asset prices move in opposite directions).
Any value between 1 and -1 indicates some degree of correlation, but generally, values higher than 0.7 or lower than -0.7 are considered significant.

Features:
Typically, correlation is measured using the closing prices. This script adds three more correlation studies based on open, high, and low prices. By using all four lines, we can get a better understanding of the pair's correlation.

How to Read This Indicator:
To use this indicator effectively, you need to input your pair as a ratio. For example, if your pair is TSN and ZBH, enter it in the symbol search as: TSN/ZBH
  • Gray Area: This area indicates "no high correlation" (default is between -0.8 and 0.8, adjustable in the settings).
  • Gray Line: This represents the close correlation within the "no high correlation" range.
  • Green Line: This represents the close correlation within the "high correlation" range.
  • Dot Lines: These represent the open, high, and low correlations.

Example Interpretations:
  • A: All four lines are close together & the line is green – very good correlation!
  • B: The line is gray, and the dot lines are apart – not a strong correlation.
  • C: When the close correlation remains green for a long time, it signals a strong correlation.

Application in Pairs Trading:
In pairs trading, aim for the highest possible correlation, and it is important to have a sustained correlation over a long period. Pairs that correlate only part of the year but not consistently are less reliable for pairs trading.

This is an example for good correlation for pairs trading:

This is an example for bad correlation for pairs trading:

Here is a view of my full indicators when doing pairs trading:

开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?