Kruegger

Bollinger Bands %B(RSI, Stoch) [Kru]

Calculate %B for RSI, Stoch, using Bollinger Bands algorithm.
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?
//
// @author Kruegger
//
// based on RSI/MFI with Bollinger Bands. Dynamic Oversold/Overbought levels, yayy! by @author LazyBear
// 
study(title = "RSI/Stoch %B Bolly bands by [Kruegger] based on [LazyBear]", shorttitle="%B(RSI, Stoch)_%D [Kru][LB]")
source = close
length_rsi = input(14, minval=1, title="RSI Length")
length_stoch = input(14, minval=1, title="Stoch Length")
lengthMA = input(14, minval=1, title="MA Length")
lengthD = input(3, minval=1, title="%D Length")
signal = input(3, minval=1, title="Signal smooth")

mult = input(2.0, minval=0.001, maxval=3, title="StDev Mult")
DrawRSI=input(true, title="Draw %B(RSI) ?", type=bool)
DrawStoch=input(false, title="Draw %B(Stoch) ?", type=bool)

// rsi
rsi_k = rsi(source, length_rsi)
rsi = sma(rsi_k,lengthD)
basis_rsi = sma(rsi, lengthMA)
dev_rsi = mult * stdev(rsi, length_rsi)
upper_rsi = basis_rsi + dev_rsi
lower_rsi = basis_rsi - dev_rsi
rsi_b = (rsi-lower_rsi) / (upper_rsi-lower_rsi)

// stoch
stoch_k = stoch(source, high, low, length_stoch)
stoch = sma(stoch_k,lengthD)
basis_stoch = sma(stoch, lengthMA)
dev_stoch = mult * stdev(stoch, length_stoch)
upper_stoch = basis_stoch + dev_stoch
lower_stoch = basis_stoch - dev_stoch
stoch_b = (stoch-lower_stoch) / (upper_stoch-lower_stoch)

// plot %b (RSI, Stoch)
plot(DrawRSI ? rsi_b:na, color=blue, linewidth=1, title="%B(RSI)")
plot(DrawStoch ? stoch_b:na, color=yellow, linewidth=1, title="%B(Stoch)")
//plot(DrawRSI ? rsi_b:na, color= (rsi_b > 0 and rsi_b[1] < 0)?blue:red, linewidth=1, title="%B(RSI)")

// Draw support line
h1 = hline(0.0, color=red, title="Lower Limit")
h2 = hline(1.0, color=green, title="Upper Limit")
h3 = hline(0.5, color=blue, title="Middle Limit")

//plotshape(rsi_b > 0 and rsi_b[1] < 0, color=lime, style=shape.triangleup, text="Buy", location=location.bottom)
//plotshape(falling(rsi_b[signal],signal), color=lime, style=shape.triangleup, text="Buy", location=location.bottom)
//plotshape(rsi_b < rsi_b[signal] and rsi_b[signal] >= rsi_b[signal-1], color=red, style=shape.triangledown, text="Sell", location=location.top)