LazyBear

EMA Enveloper Indicator & a crazy prediction

ema
EMAEnvelope indicator does just that, draws a nice user-defined period EMA envelope (overlay).

It also can highlight the Bull/Bear breaks using different colors
- Green : High > EMA_HIGH
- Lime : (High > EMA_HIGH) and (Low > EMA_HIGH)
- Orange : Low < EMA_LOW
- Red : (Low < EMA_LOW) and (High < EMA_LOW)

Background highlighting is user-configurable.

Now to the (crazy) prediction: Based on a 100-period EMAEnvelope, we may have to go down to ~427.3 before starting turning Green. Look at the 2 Orange/Red areas highlighted.

EMA 200 tells us a different story, BTW.

List of my free indicators: bit.ly/1LQaPK8
List of my indicators at Appstore: blog.tradingview.com/?p=970
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//
// @author LazyBear
// v01 - initial release
//
study(title = "EMAEnvelope [LazyBear]", shorttitle="EMAEnvelope[LB]", overlay=true)
src = close
length=input(20)
HighlightColors = input(true, title="Bull/Bear highlights?", type=bool)

e=ema(close, length)
eu = ema(high, length)
el = ema(low, length)

plot(e, style=cross, color=aqua)
plot(eu, color=red, linewidth=2)
plot(el, color=lime, linewidth=2)

bull_color_normal = green
bull_color_strong = lime
bear_color_normal = orange
bear_color_strong = red
sidewise_color = blue

bull_f = (high > eu and low > el)
bear_f = (high < eu and low < el)
sidewise_f = (not bull_f) and (not bear_f)
b_color = bull_f ? bull_color_normal : (bear_f ? bear_color_normal : (sidewise_f ? sidewise_color : na))
d_color = (bull_f ? (low > eu ? bull_color_strong : b_color) : bear_f ? ( high < el ? bear_color_strong : b_color) : b_color)
bgcolor(HighlightColors ? d_color : na)