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.
Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.

Vuoi usare questo script sui tuoi grafici?
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)