Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // @author LazyBear
- //
- // List of my public indicators: http://bit.ly/1LQaPK8
- // List of my app-store indicators: http://blog.tradingview.com/?p=970
- //
- // v2 - Made midline connected based on connectRanges option
- //
- study("Range Identifier [LazyBear]", shorttitle="RID_LB", overlay=true)
- connectRanges=input(false, title="Connect Ranges")
- showMidLine=input(false, title="Show MidLine")
- lengthEMA=input(34, title="EMA Length")
- showEMA=input(true, title="Show EMA")
- hc=input(true, title="Highlight Consolidation")
- e=ema(close,lengthEMA)
- up = close<nz(up[1]) and close>down[1] ? nz(up[1]) : high
- down = close<nz(up[1]) and close>down[1] ? nz(down[1]) : low
- mid = avg(up,down)
- ul=plot(connectRanges?up:up==nz(up[1])?up:na, color=gray, linewidth=2, style=linebr, title="Up")
- ll=plot(connectRanges?down:down==nz(down[1])?down:na, color=gray, linewidth=2, style=linebr, title="Down")
- dummy=plot(hc?close>e?down:up:na, color=gray, style=circles, linewidth=0, title="Dummy")
- fill(ul,dummy, color=lime)
- fill(dummy,ll, color=red)
- plot(showMidLine?connectRanges?mid:((mid==nz(mid[1]))?mid:na):na, color=gray, linewidth=1, title="Mid", style=linebr)
- plot(showEMA?e:na, title="EMA", color=black, linewidth=2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement