Advertisement
Guest User

Vervoort Modified %b with MTF support [LazyBear]

a guest
Oct 11th, 2014
1,506
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. //
  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=resolution)
  23.  
  24. ohlc = useCustomTimeframe ? security(tickerid, customTimeframe, ohlc4) : ohlc4
  25. h=useCustomTimeframe ? security(tickerid, customTimeframe, high) : high
  26. l=useCustomTimeframe ? security(tickerid, customTimeframe, low) : low
  27.  
  28. haOpen=(ohlc[1]+nz(haOpen[1]))/2
  29. haC=(ohlc+haOpen+max(h, haOpen)+min(l, haOpen))/4
  30.  
  31. tma1 = calc_tema(haC,temaLength)
  32. tma2 = calc_tema(tma1, temaLength)
  33. diff = tma1-tma2
  34. zlha = tma1+diff
  35. 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
  36.  
  37. ub=50+stdevHigh*stdev(percb,stdevLength)
  38. lb=50-stdevLow*stdev(percb,stdevLength)
  39. ul=plot(ub, color=red, title="Stdev+")
  40. ll=plot(lb, color=green, title="Stdev-")
  41. plot((ub+lb)/2, color=blue, style=3, title="Stdev Mid")
  42. fill(ul, ll, red)
  43. plot(percb, linewidth=2, color=maroon, title="SVE %b")
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement