Keltner Channel with auto highlighting of Bear/Bull reversals

2815 4 159
*** New version @
Keltner Channel v2 - Auto highlighting of Bull/Bear trends

All options configurable.

Reversals are marked using crosses. as well as highlighted using green/red color (depending on bull/bear). Enjoy!
Remove from Favorite Scripts Add to Favorite Scripts
// @author LazyBear
// @credits Formula taken from
study(title="Keltner Channel [LazyBear]", overlay=true)
offset = 1
lengthMiddle = input(20,  title="MiddleEMA")
channelATR = input(10, title="Channel wall ATR")
channelWidth = input(2, title = "Channel Width")
showBarColor = input(true, title="Highlight Bear/Bull reversals?", type=bool)

emaVal = ema(close,lengthMiddle)
upperVal = emaVal + channelWidth * atr(channelATR)
lowerVal = emaVal - channelWidth * atr(channelATR)

middle_line = plot(emaVal, style=circles, linewidth=2)
upper_line = plot(upperVal)
lower_line = plot(lowerVal)
fill(upper_line, lower_line, color=green, transp=80)

bearish_reversal = high > upperVal 
bear_point = bearish_reversal ? (high+offset) : na
bear_color = bearish_reversal ? red : na

bullish_reversal = low < lowerVal
bull_point = bullish_reversal ? (low-offset) : na
bull_color = bullish_reversal ? green : na

bar_color = bearish_reversal ? bear_color : (bullish_reversal ? bull_color : na)

plot(bear_point, color = bear_color, style=cross, linewidth=2)
plot(bull_point, color = bull_color, style=cross, linewidth=2)

bgcolor(showBarColor ? bar_color : na)
List of my free indicators:
List of my indicators at Appstore:

3 years ago
Nice script. Thanks for sharing.
+1 Reply
LazyBear PRO stavros
3 years ago
Thanks @stavros. I just fixed the color codes and published again - new one @
Keltner Channel v2 - Auto highlighting of Bull/Bear trends
+2 Reply
2 years ago
LB this is very nice, one question, is there a way for me to reduce the channelwidth input from 2 to 1.5?
LazyBear PRO jtdorman
2 years ago
Yes. You can change it via options page.
+1 Reply
Ideas Scripts Chart
United States
United Kingdom
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out