Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- // @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=input.resolution)
- security_1 = security(syminfo.tickerid, customTimeframe, ohlc4)
- ohlc = useCustomTimeframe ? security_1 : ohlc4
- security_2 = security(syminfo.tickerid, customTimeframe, high)
- h = useCustomTimeframe ? security_2 : high
- security_3 = security(syminfo.tickerid, customTimeframe, low)
- l = useCustomTimeframe ? security_3 : low
- haOpen = 0.0
- 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=color.red, title="Stdev+")
- ll = plot(lb, color=color.green, title="Stdev-")
- plot((ub + lb) / 2, color=color.blue, style=3, title="Stdev Mid")
- fill(ul, ll, color.red)
- plot(percb, linewidth=2, color=color.maroon, title="SVE %b")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement