SHARE
TWEET

Range Identifier v3 [LazyBear]

lazybeartv May 5th, 2015 1,053 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. // v3 - Filter ranges, Additional Non-Overlay mode.
  9. //
  10. study("Range Identifier v3 [LazyBear]", shorttitle="RIDV3_LB", overlay=true)
  11. ovm=input(true, title="Overlay Mode")
  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. hcf=input(false, title="Mark only filtered ranges")
  18. fb=input(5, title="Filter bars")
  19. e=ema(close,lengthEMA)
  20. inr=close<nz(up[1]) and close>down[1]
  21. up =  inr ? nz(up[1]) : high
  22. down = inr ? nz(down[1]) : low
  23. count=inr?nz(count[1])+1:0
  24. mid = ovm?avg(up,down):na
  25. ul=plot(ovm?connectRanges?up:up==nz(up[1])?up:na:na, color=gray, linewidth=2, style=linebr, title="Up")
  26. ll=plot(ovm?connectRanges?down:down==nz(down[1])?down:na:na, color=gray, linewidth=2, style=linebr, title="Down")
  27. dummy=plot(ovm and hc and (not hcf)?close>e?down:up:na, color=gray, style=circles, linewidth=0, title="DummyHC")
  28. dummyHCF=plot(ovm and hc and hcf?(count>=fb?down:up):na, color=gray, style=circles, linewidth=0, title="DummyHCF")
  29. fill(ul,dummy, color=lime, title="CloseAboveEMAFill")
  30. fill(dummy,ll, color=red, title="CloseBelowEMAFill")
  31. fill(dummyHCF,ul, color=fuchsia, title="RangeHasMoreBarsFill")
  32. fill(dummyHCF,ll, color=gray, title="RangeHasNotEnoughBarsFill")
  33. plot(ovm and showMidLine?connectRanges?mid:((mid==nz(mid[1]))?mid:na):na, color=gray, linewidth=1, title="Mid", style=linebr)
  34. plot(ovm and showEMA?e:na, title="EMA", color=black, linewidth=2)
  35. plot(not ovm?count:na, style=columns, title="RangeBarCount", color=count==fb?fuchsia:count>fb?(close>e?green:red):gray)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top