forexpirate

BITCOIN pairs combined slopes

First Version of a BITCOIN multi exchange slope of moving average indicator. It takes the slope of a moving average from multiple exchanges to give a broader picture of what Bitcoin USD is doing. There is a bitcoin China and USDCHY pair in the code but it is not in the actual calculation. It is there for version two later on. Stay posted
開源腳本

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

想在圖表上使用此腳本?
//@version=2
study(title="BITCOIN pairs combined slopes", 
     shorttitle="BITCOIN pairs combined slopes")
// Add the inputs
l = input(title="Length", type=integer,
     defval=15, minval=5)
smaLength = input(title="EMA length", type=integer,
     defval=21, minval=5)
p0 = input(title="Other data series", type=symbol,defval="bitstamp:btcusd")
p1 = input(title="Other data series", type=symbol,defval="coinbase:btcusd")
p2 = input(title="Other data series", type=symbol,defval="huobi:btcusd")
p3 = input(title="Other data series", type=symbol,defval="bitfinex:btcusd")
p4 = input(title="Other data series", type=symbol,defval="okcoin:btcusd")
p5 = input(title="Other data series", type=symbol,defval="itbit:btcusd") 
p6 = input(title="Other data series", type=symbol,defval="btcchina:btccny")
p7 = input(title="Other data series", type=symbol,defval="FX_IDC:usdcny")
p8 = input(title="Other data series", type=symbol,defval="FX_IDC:usdcnh")
p9 = input(title="Other data series", type=symbol,defval="FX_IDC:eurusd")
p10 = input(title="Other data series", type=symbol,defval="FX_IDC:audjpy")
p11 = input(title="Other data series", type=symbol,defval="FX_IDC:gbpsgd")
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")
// Get the additional data series
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)
sma0 = sma(s0, l)
sma1 = sma(s1, l)
sma2 = sma(s2, l)
sma3 = sma(s3, l)
sma4 = sma(s4, l)
sma5 = sma(s5, l)
sma6 = sma(s6, l)
sma7 = sma(s7, l)
sma8 = sma(s8, l)
sma9 = sma(s9, l)
sma10 = sma(s10, l)
sma11 = sma(s11, l)
sma12 = sma(s12, l)
sma13 = sma(s13, l)
sma14 = sma(s14, l)
m0 = (sma0-sma0[1])*corr0
m1 = (sma1-sma1[1])*corr1
m2 = (sma2-sma2[1])*corr2
m3 = (sma3-sma3[1])*corr3
m4 = (sma4-sma4[1])*corr4
m5 = (sma5-sma5[1])*corr5
m6 = (sma6-sma6[1])*corr6
m7 = (sma7-sma7[1])*corr7
m8 = (sma8-sma8[1])*corr8
m9 = (sma9-sma9[1])*corr9
m10 = ((sma10-sma10[1])*corr10)/100
m11 = (sma11-sma11[1])*corr11
m12 = (sma12-sma12[1])*corr12
m13 = ((sma13-sma13[1])*corr13)/100
m14 = (sma14-sma14[1])*corr14

compm = m0+m1+m2+m3+m4+m5
// m0+m1+m2+m3+m4+m5+m6+m7+m8+m9+m10+m11+m12+m13+m14
compmave = sma(compm, smaLength)

// Plot values
hline(0, color=white, linewidth=1)
dircolor =  iff( compm > 0, green, red)
plot(series=compm,color=dircolor,title="Combined Slope", style=columns)
plot(series=compmave, color=blue, linewidth=3 ,title="Count Average")

評論

can you explain what are those green and red bars.. EMA seems to be crossing over quite often? also did you notice how it turned around 20000 level
回覆