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.

Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?
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)