RicardoSantos

[RS]Multiple Bollinger Bands Candles V0

EXPERIMENTAL: using multiple length bollinger bands to create a better reading of ?price/range? strength?.
• calculates 2 candle plots for upper and lower bands, were the high and low are the extremes of the bands,
open is the previous close of the band and close is the extreme midline.
開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?
study(shorttitle="[RS]mBBC V0", title="[RS]Multiple Bollinger Bands Candles V0", overlay=true)
length0 = input(4, minval=1)
length1 = input(8, minval=1)
length2 = input(16, minval=1)
length3 = input(32, minval=1)

src = input(close, title="Source")
mult = input(2.0, minval=0.001, maxval=50)

deviation(_s, _l) => mult * stdev(_s, _l)
base0 = sma(src, length0)
base1 = sma(src, length1)
base2 = sma(src, length2)
base3 = sma(src, length3)

upper0 = base0 + deviation(src, length0)
upper1 = base1 + deviation(src, length1)
upper2 = base2 + deviation(src, length2)
upper3 = base3 + deviation(src, length3)

lower0 = base0 - deviation(src, length0)
lower1 = base1 - deviation(src, length1)
lower2 = base2 - deviation(src, length2)
lower3 = base3 - deviation(src, length3)

mbb_upper_high = max(upper0, max(upper1, max(upper2, upper3)))
mbb_upper_low = min(upper0, min(upper1, min(upper2, upper3)))
mbb_upper_close = max(base0, max(base1, max(base2, base3)))
mbb_lower_high = max(lower0, max(lower1, max(lower2, lower3)))
mbb_lower_low = min(lower0, min(lower1, min(lower2, lower3)))
mbb_lower_close = min(base0, min(base1, min(base2, base3)))

upper_palete = falling(mbb_upper_close, 1)?orange:rising(mbb_upper_close, 1)?olive:silver
lower_palete = falling(mbb_lower_close, 1)?orange:rising(mbb_lower_close, 1)?olive:silver

plotbar(mbb_upper_close[1], mbb_upper_high, mbb_upper_low, mbb_upper_close, color=upper_palete)//, wickcolor=orange)
plotbar(mbb_lower_close[1], mbb_lower_high, mbb_lower_low, mbb_lower_close, color=lower_palete)//, wickcolor=olive)