Advertisement
lazybeartv

Range Identifier v2 [LazyBear]

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