Guest User

Pretty Weis Wave _ VonKr

a guest
May 12th, 2021
754
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. //@version=4
  2. //VonKr
  3. study("Pretty_Weis Wave Volume", shorttitle="Pretty_Weis Wave Volume", overlay=false, resolution="")
  4. method = input(defval="ATR", options=["ATR", "Traditional", "Part of Price"], title="Renko Assignment Method")
  5. methodvalue = input(defval=14.0, type=input.float, minval=0, title="Value")
  6. pricesource = input(defval="Close", options=["Close", "Open / Close", "High / Low"], title="Price Source")
  7. useClose = pricesource == "Close"
  8. useOpenClose = pricesource == "Open / Close" or useClose
  9. useTrueRange = input(defval="Auto", options=["Always", "Auto", "Never"], title="Use True Range instead of Volume")
  10. isOscillating = input(defval=false, type=input.bool, title="Oscillating")
  11. normalize = input(defval=false, type=input.bool, title="Normalize")
  12. vol = useTrueRange == "Always" or useTrueRange == "Auto" and na(volume) ? tr : volume
  13. op = useClose ? close : open
  14. hi = useOpenClose ? close >= op ? close : op : high
  15. lo = useOpenClose ? close <= op ? close : op : low
  16.  
  17. if method == "ATR"
  18. methodvalue := atr(round(methodvalue))
  19. if method == "Part of Price"
  20. methodvalue := close / methodvalue
  21.  
  22. currclose = float(na)
  23. prevclose = nz(currclose[1])
  24. prevhigh = prevclose + methodvalue
  25. prevlow = prevclose - methodvalue
  26. currclose := hi > prevhigh ? hi : lo < prevlow ? lo : prevclose
  27.  
  28. direction = int(na)
  29. direction := currclose > prevclose ? 1 : currclose < prevclose ? -1 : nz(direction[1])
  30. directionHasChanged = change(direction) != 0
  31. directionIsUp = direction > 0
  32. directionIsDown = direction < 0
  33.  
  34. barcount = 1
  35. barcount := not directionHasChanged and normalize ? barcount[1] + barcount : barcount
  36. vol := not directionHasChanged ? vol[1] + vol : vol
  37. res = barcount > 1 ? vol / barcount : vol
  38.  
  39. plot(isOscillating and directionIsDown ? -res : res, style=plot.style_columns, color=directionIsUp ? color.green : color.red, transp=0, linewidth=4, title="Wave Volume")
  40.  
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment