Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // @author LazyBear
- // List of all my indicators:
- // https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
- // v2 - MTF support
- // v1 - initial release
- //
- study("Vervoort Modified BB%b v2 [LazyBear]", shorttitle="VMBB%b_MTF_LB")
- calc_tema(s, length) =>
- ema1 = ema(s, length)
- ema2 = ema(ema1, length)
- ema3 = ema(ema2, length)
- 3 * (ema1 - ema2) + ema3
- length=input(18, minval=2, maxval=100, title="%B Length")
- temaLength=input(8, title="TEMA Length")
- stdevHigh=input(1.6, title="Stdev High")
- stdevLow=input(1.6, title="Stdev Low")
- stdevLength=input(200, title="Stdev Length")
- useCustomTimeframe=input(false)
- customTimeframe=input("D", type=resolution)
- ohlc = useCustomTimeframe ? security(tickerid, customTimeframe, ohlc4) : ohlc4
- h=useCustomTimeframe ? security(tickerid, customTimeframe, high) : high
- l=useCustomTimeframe ? security(tickerid, customTimeframe, low) : low
- haOpen=(ohlc[1]+nz(haOpen[1]))/2
- haC=(ohlc+haOpen+max(h, haOpen)+min(l, haOpen))/4
- tma1 = calc_tema(haC,temaLength)
- tma2 = calc_tema(tma1, temaLength)
- diff = tma1-tma2
- zlha = tma1+diff
- percb = (calc_tema(zlha,temaLength)+2*stdev(calc_tema(zlha,temaLength),length) - wma(calc_tema(zlha,temaLength),length))/(4*stdev(calc_tema(zlha,temaLength),length))*100
- ub=50+stdevHigh*stdev(percb,stdevLength)
- lb=50-stdevLow*stdev(percb,stdevLength)
- ul=plot(ub, color=red, title="Stdev+")
- ll=plot(lb, color=green, title="Stdev-")
- plot((ub+lb)/2, color=blue, style=3, title="Stdev Mid")
- fill(ul, ll, red)
- plot(percb, linewidth=2, color=maroon, title="SVE %b")
Advertisement
Advertisement