Cant seem to get my tradingview bollinger band to match my prorealtime setup. Please help, this is the trading view code in attachment.
My settings are Length 10, std dev 0.66, source – close, offset – 1 from tradingview
Different data in equals different result out. Unless your Tradingview is getting the exact same data from the exact same broker as your PRT platform is then why would you expect the same result?
Also please don’t expect people to download TXT files. Post the code directly in your post.
That needs a custom coding, here is the code for that kind of bollinger bands (short term, 0.66 factor for the upper and lower bands and offset by 1 period):
avg = average[10]
istd = std[10]
up = avg+istd*.66
dn = avg-istd*.66
return up[1],dn[1]
Hi sorry heres the code –
//@version=4
study(shorttitle=”BB”, title=”Bollinger Bands”, overlay=true, resolution=””)
length = input(20, minval=1)
src = input(close, title=”Source”)
mult = input(2.0, minval=0.001, maxval=50, title=”StdDev”)
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis – dev
offset = input(0, “Offset”, type = input.integer, minval = -500, maxval = 500)
plot(basis, “Basis”, color=#872323, offset = offset)
p1 = plot(upper, “Upper”, color=color.teal, offset = offset)
p2 = plot(lower, “Lower”, color=color.teal, offset = offset)
fill(p1, p2, title = “Background”, color=#198787, transp=95)
Thank you for the reply. I tried the same code which i found in this forum before. It still come up differently, i think it may be the ‘source’. im not sure. i put the tradingview code in my reply above.
Hi again, i just want to say thankyou. I tried this code exactly and it was what i was looking for. please ignore my above reply. Cant thank you enough.