AleksanderThor

Check The Correlation

1237 views
119
1237 4
Check the correlation of different assets on your preferred timeframe to find trends, patterns, new strategies or to minimize the exposure in correlated assets
Remove from Favorite Scripts Add to Favorite Scripts
Hey, nice work. Can you send pinescript code for comparing XAUUSD and DXY? Thanks.
+1 Reply
Can I change the asset (es, XAUUSD, XAGUSD etc.)
Reply
AleksanderThor gianfranco60
@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)
T2=security(Ticker2, res, close)

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)
Reply
beautiful script :-)
+4 Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Get Help Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing Get Help Ideas Published Followers Following Private Messages Chat Sign Out