Version 2.0 of VPT_OBV
Adds an adjustable Bollinger Band overlay on the VPT_OBV.
Adds an adjustable Bollinger Band overlay on the VPT_OBV.
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)