Advertisement
JustUncleL

Range Identifier [LazyBear] revised by JustUncleL

Aug 7th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. //@version=3
  2. study("Range Identifier [LazyBear] revised by JustUncleL", shorttitle="RID_LB", overlay=true)
  3.  
  4. // author LazyBear
  5. //
  6. // List of my public indicators: http://bit.ly/1LQaPK8
  7. // List of my app-store indicators: http://blog.tradingview.com/?p=970
  8. //
  9. // revisions:
  10. // - Version3 Pinescript update - JustUncleL
  11. //
  12. connectRanges=input(false, title="Connect Ranges")
  13. showMidLine=input(false, title="Show MidLine")
  14. lengthEMA=input(34, title="EMA Length")
  15. showEMA=input(true, title="Show EMA")
  16. hc=input(true, title="Highlight Consolidation")
  17. e=ema(close,lengthEMA)
  18. up = 0.0
  19. down = 0.0
  20. up := close<nz(up[1]) and close>down[1] ? nz(up[1]) : high
  21. down := close<nz(up[1]) and close>down[1] ? nz(down[1]) : low
  22. mid = avg(up,down)
  23. ul=plot(connectRanges?up:up==nz(up[1])?up:na, color=gray, linewidth=2, style=linebr, title="Up")
  24. ll=plot(connectRanges?down:down==nz(down[1])?down:na, color=gray, linewidth=2, style=linebr, title="Down")
  25. dummy=plot(hc?close>e?down:up:na, color=gray, style=circles, linewidth=0, title="Dummy")
  26. fill(ul,dummy, color=lime)
  27. fill(dummy,ll, color=red)
  28. plot(showMidLine?mid:na, color=gray, linewidth=1, title="Mid")
  29. plot(showEMA?e:na, title="EMA", color=black, linewidth=2)
  30. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement