4X4good

4x4_USOIL correlation

29
Determine the correlation of your selected chart to USOIL.

Inputs for Resolution and Time Frame available from the Format menu of the indicator.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//@version=2
study("4x4_USOIL correlation",shorttitle="USOIL Corr.")
res=input(defval="D",type=resolution)
length=input(defval=20,minval=2,type=integer,step=1)
s1=security(tickerid,res, close[0])
s2=security("USOIL",res, close[0])

cor=correlation(s1,s2,length)
plot(cor,color=blue,linewidth=3,transp=0,title="corr")

hline(.90,linewidth=3)
hline(0.0,linewidth=3)
hline(-.90,linewidth=3)