kinetix360

BB % Correlation

209
BB% of Correlation, is the indication frequently used by Quant Traders to define the momentum for their Arbitrage Trading Strategy. If anyone here is a Quant Trading and find this is not a correct script, please feel free to fix it, because I am not a programer. Thank you.

Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?
study(title = "BB % Correlation", shorttitle = "BB % Correl")

source = hlc3
//length = input(14, minval=1, title="RSI Period") 
//corlength = input(30, minval=1, title="Correlation Period)
bblength = input(20, minval=1, title="BB Period")
mult = input(2.0, minval=0.001, maxval=50, title="StdDev")
HighlightBreaches=input(false, title="Highlight Oversold/Overbought?", type=bool)

//Define RSI
//rsi_s = rsi(source, length)


//Define Correlation
sym = input(title="Symbol", type=symbol, defval="XAUUSD", confirm=true)
src = input(close, title="Source")
//corlength = input(20, minval=1)
corlength = input(30, minval=1, title="Correlation Period")

res=period

ovr = security(sym, res, src)
correl = correlation(src, ovr, corlength)


// BB of RSI

basis = sma(correl, bblength)
dev = mult * stdev(correl, bblength)
upper = basis + dev
lower = basis - dev

bbr = (correl - lower)/(upper - lower)
plot(bbr, color=teal)
band1 = hline(1, color=gray, linestyle=dashed)
band0 = hline(0, color=gray, linestyle=dashed)
fill(band1, band0, color=teal)

//p1 = plot(upper, color=blue)
//p2 = plot(lower, color=blue)
//fill(p1,p2, blue)

b_color = (correl > upper) ? red : (correl < lower) ? green : na
//b_color = (bbr > band1) ? red : (bbr < band0) ? green : na
bgcolor(HighlightBreaches ? b_color : na)