LazyBear

Range Identifier [LazyBear]

---- May 05 2015 -----

Added support for filtered ranges:
RID V3 : pastebin.com/Z11JYVQK

RIDv3 has full backward compatibility (!?), meaning all my descriptions below still apply for V3.
-- In addition, I have added a NON-OVERLAY mode, which can be put in its own pane, that shows the number of bars in the current range.
-- in Overlay mode, you can switch on/off filtering ranges based on the bar count.

Sample chart:

---- April 30 2015 -----

Updated the source to show a connected Midline only when ConnectRanges option is enabled.
Updated src: pastebin.com/xgweVbrC

Sample chart:

---- Original Desc ----

This is a simple indicator that highlights the price ranges. Very helpful in determining a breakout.

There are many ways to incorporate this in to your strategy. One simple idea could be to buy if the price breaks above a range, when above the specified EMA, and to SELL when it breaks down from a range below the EMA.

All options are configurable. Alerts can be setup using the specified plot names.

By default it shows only the ranges, but can be configured to show the full "channel". Chart below shows connected ranges with highlights ON.

Range highlighting can be turned OFF. Chart below shows that:

Note for the pine coders:
As you probably noticed in the charts above, single range is showing 2 colors(red/green). Fill() doesn't accept a series for colors, so I worked around this using two fill() statements with a moving DUMMY line, to get this mixed color effect.

List of my public indicators: bit.ly/1LQaPK8
List of my app-store indicators: blog.tradingview.com/?p=970

List of my free indicators: bit.ly/1LQaPK8
List of my indicators at Appstore: blog.tradingview.com/?p=970
نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الكود في منشور تحكمه قواعد الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟
//
// @author LazyBear 
// 
// List of my public indicators: http://bit.ly/1LQaPK8 
// List of my app-store indicators: http://blog.tradingview.com/?p=970 
//
//
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?mid:na, color=gray, linewidth=1, title="Mid")
plot(showEMA?e:na, title="EMA", color=black, linewidth=2)