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)