BrandonMendez

VPT_OBV Version2.0

Version 2.0 of VPT_OBV

Adds an adjustable Bollinger Band overlay on the VPT_OBV.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
study("VPT")

length = input(5, minval=1, title="SMA Length")
BBlength = input(25, minval=1, title="BB Length")
StdDev = input(2, minval=0.001, maxval=3.0, title="StdDev")

hilow = ((high - low)*100)
openclose = ((close - open)*100)
vol = (volume / hilow)
spreadvol = (openclose * vol)


VPT = spreadvol + cum(spreadvol)
SMA = sma(VPT,length)

BB = stdev(SMA, BBlength)
Upper = (SMA + (StdDev * BB))
Lower = (SMA - (StdDev * BB))

plot(VPT, color=black, style=line, linewidth=1 )
plot(SMA, color=gray, style=line, linewidth=1)
B1 = plot(Upper, color=gray, style=line, linewidth=1)
B2 = plot(Lower, color=gray, style=line, linewidth=1)
fill(B1, B2, color=gray, transp=50)