TradingView
AleksanderThor
Dec 15, 2016 9:38 AM

Check The Correlation 

DAX index of German listed sharesFXCM

描述

Check the correlation of different assets on your preferred timeframe to find trends, patterns, new strategies or to minimize the exposure in correlated assets
评论
RCP_
beautiful script :-)
UmarAbdurRehman
Hey, nice work. Can you send pinescript code for comparing XAUUSD and DXY? Thanks.
gianfranco60
Can I change the asset (es, XAUUSD, XAGUSD etc.)
AleksanderThor
@gianfranco60, Sure, just type the tickers in field instead of "EURUSD", "USOIL" etc. Otherwise if you want to check the correlation of only Gold and Silver while checking another asset you can use the following script:

study("Correlation")

res=input(defval="D",type=resolution, title="Timeframe")
length=input(defval=20,minval=2,type=integer,step=1, title = "Number of bars back")

Ticker1 = input("XAGUSD")
Ticker2 = input("XAUUSD")

T1=security(Ticker1, res, close[0])
T2=security(Ticker2, res, close[0])

cor=correlation(T1,T2,length)

plot(cor,color=blue,linewidth=1,transp=0)

hline(.80,linewidth=1)
hline(0.0,linewidth=1)
hline(-.80,linewidth=1)
更多