forexpirate

Correlation of chart symbol to different Index-ETF-currency

Script plots correlation of chart symbol to a variety of indexes, symbols, equities. ** Original idea was to find Bitcoin correlation, which I did not. Built in correlations are: Nikie, DAX , SPY , AAPL , US Dollar , Gold , EURUSD , USDCNY , EEM , QQQ , XLK , XLF , USDJPY , EURGBP
開源腳本

秉持真正的TradingView精神,該腳本的作者將其開源發佈,因此交易者可以理解和驗證它。為作者加油!您可以免費使用它,但是在發佈中重複使用此程式碼受網站規則的約束。您可以把它加入到常用以在圖表上使用它。

想在圖表上使用此腳本?
//@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")

評論

wow. nice work.. how to do alteration in this. and is there any way to include USDINR too in this..
回覆
It is a good work but I think is better if you can choice the symbols to show correlation
回覆
Something goes wrong. It doesn't work.
回覆
Hello, the task of the indicator is to show correlation. You can change what instruments you measure correlation.
回覆
Gorbie forexpirate
It works only on a daily view
回覆
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.
回覆
Gorbie forexpirate
Okay! Well done. Great work mate!
回覆
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.
回覆
首頁 股票篩選器 外匯篩選器 加密貨幣篩選器 全球財經日曆 關於 圖表功能 價格 推薦朋友 網站規則 幫助中心 網站 & 經紀商解決方案 小工具 圖表解決方案 輕量圖表庫 部落格 & 新聞 推特