forexpirate

Correlation of chart symbol to different Index-ETF-currency

Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title="BITCOIN Index-ETF-currency Corr",  shorttitle="BITCOIN Index-ETF-currency Corr")
// Add the inputs
l = input(title="Length", type=integer,  defval=20, minval=5)

p0 = input(title="Other data series", type=symbol,defval="JPN")
p1 = input(title="Other data series", type=symbol,defval="DAX")
p2 = input(title="Other data series", type=symbol,defval="amex:SPY")
p3 = input(title="Other data series", type=symbol,defval="NASDAQ:aapl")
p4 = input(title="Other data series", type=symbol,defval="usdollar")
p5 = input(title="Other data series", type=symbol,defval="amex:gld") 
p6 = input(title="Other data series", type=symbol,defval="FX_IDC:EURUSD")
p7 = input(title="Other data series", type=symbol,defval="FX_IDC:usdcny")
p8 = input(title="Other data series", type=symbol,defval="amex:eem")
p9 = input(title="Other data series", type=symbol,defval="NASDAQ:qqq")
p10 = input(title="Other data series", type=symbol,defval="amex:xlk")
p11 = input(title="Other data series", type=symbol,defval="amex:xlf")
//p12 = input(title="Other data series", type=symbol,defval="FX_IDC:usdcnh")
p13 = input(title="Other data series", type=symbol,defval="FX_IDC:usdjpy")
p14 = input(title="Other data series", type=symbol,defval="FX_IDC:eurgbp")

s0= security(p0, period, close)
s1= security(p1, period, close)
s2= security(p2, period, close)
s3= security(p3, period, close)
s4= security(p4, period, close)
s5= security(p5, period, close)
s6= security(p6, period, close)
s7= security(p7, period, close)
s8= security(p8, period, close)
s9= security(p9, period, close)
s10= security(p10, period, close)
s11= security(p11, period, close)
//s12= security(p12, period, close)
s13= security(p13, period, close)
s14= security(p14, period, close)
// Calculate correlation and slopes
corr0 = correlation(close, s0, l)
corr1 = correlation(close, s1, l)
corr2 = correlation(close, s2, l)
corr3 = correlation(close, s3, l)
corr4 = correlation(close, s4, l)
corr5 = correlation(close, s5, l)
corr6 = correlation(close, s6, l)
corr7 = correlation(close, s7, l)
corr8 = correlation(close, s8, l)
corr9 = correlation(close, s9, l)
corr10 = correlation(close, s10, l)
corr11 = correlation(close, s11, l)
//corr12 = correlation(close, s12, l)
corr13 = correlation(close, s13, l)
corr14 = correlation(close, s14, l)
// SMA calc


plot(corr0,color=red,title="Japan")
plot(corr1,color=silver,title="Germany")
plot(corr2,color=white,title="SP500")
plot(corr3,color=maroon,title="Apple")
plot(corr4,color=purple,title="US Dollar")
plot(corr5,color=green,title="Gold")
plot(corr6,color=lime,title="EURUSD")
plot(corr7,color=olive,title="USDCNY")
plot(corr8,color=yellow,title="EEM")
plot(corr9,color=navy,title="Nasdaq")
plot(corr10,color=teal,title="Tech ETF")
plot(corr11,color=orange,title="Fin ETF")
//plot(corr12,color=aqua,title="")
plot(corr13,color=silver,title="USDJPY")
plot(corr14,color=white,title="EURGBP")

Something goes wrong. It doesn't work.
Reply
Hello, the task of the indicator is to show correlation. You can change what instruments you measure correlation.
Reply
Gorbie forexpirate
It works only on a daily view
Reply
I see. Then one or more of the symbols in the list do not have intraday prices. If you remove those then it will work.
Reply
Gorbie forexpirate
Okay! Well done. Great work mate!
Reply
Thank you, glad it will works for you now. I built it first hunting for bitcoin correlations. The goal was to see is anything drives bitcoin, even if for only a few months or so. I did not find anything really big in the bitcoin arena. But the script can be used for anything.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out