Advertisement
freeman03

vervoort

Oct 21st, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. //@version=4
  2. // @author LazyBear
  3. // List of all my indicators:
  4. // https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
  5. // v2 - MTF support
  6. // v1 - initial release
  7. //
  8. study("Vervoort Modified BB%b v2 [LazyBear]", shorttitle="VMBB%b_MTF_LB")
  9. calc_tema(s, length) =>
  10. ema1 = ema(s, length)
  11. ema2 = ema(ema1, length)
  12. ema3 = ema(ema2, length)
  13. 3 * (ema1 - ema2) + ema3
  14.  
  15. length = input(18, minval=2, maxval=100, title="%B Length")
  16. temaLength = input(8, title="TEMA Length")
  17. stdevHigh = input(1.6, title="Stdev High")
  18. stdevLow = input(1.6, title="Stdev Low")
  19. stdevLength = input(200, title="Stdev Length")
  20.  
  21. useCustomTimeframe = input(false)
  22. customTimeframe = input("D", type=input.resolution)
  23.  
  24. security_1 = security(syminfo.tickerid, customTimeframe, ohlc4)
  25. ohlc = useCustomTimeframe ? security_1 : ohlc4
  26. security_2 = security(syminfo.tickerid, customTimeframe, high)
  27. h = useCustomTimeframe ? security_2 : high
  28. security_3 = security(syminfo.tickerid, customTimeframe, low)
  29. l = useCustomTimeframe ? security_3 : low
  30. haOpen = 0.0
  31. haOpen := (ohlc[1] + nz(haOpen[1])) / 2
  32. haC = (ohlc + haOpen + max(h, haOpen) + min(l, haOpen)) / 4
  33.  
  34. tma1 = calc_tema(haC, temaLength)
  35. tma2 = calc_tema(tma1, temaLength)
  36. diff = tma1 - tma2
  37. zlha = tma1 + diff
  38. percb = (calc_tema(zlha, temaLength) + 2 * stdev(calc_tema(zlha, temaLength), length) -
  39. wma(calc_tema(zlha, temaLength), length)) /
  40. (4 * stdev(calc_tema(zlha, temaLength), length)) * 100
  41.  
  42. ub = 50 + stdevHigh * stdev(percb, stdevLength)
  43. lb = 50 - stdevLow * stdev(percb, stdevLength)
  44. ul = plot(ub, color=color.red, title="Stdev+")
  45. ll = plot(lb, color=color.green, title="Stdev-")
  46. plot((ub + lb) / 2, color=color.blue, style=3, title="Stdev Mid")
  47. fill(ul, ll, color.red)
  48. plot(percb, linewidth=2, color=color.maroon, title="SVE %b")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement