OPEN-SOURCE SCRIPT

Pops new script

43
//version=5
indicator("Pops TSLA Trend Overlay v2", overlay=true)

// EMAs
ema8 = ta.ema(close, 8)
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)

plot(ema8, "EMA 8", color=color.blue)
plot(ema21, "EMA 21", color=color.orange)
plot(ema50, "EMA 50", color=color.green, linewidth=2)

// BB / Keltner Squeeze
basis = ta.sma(close, 20)
dev = ta.stdev(close, 20)
bbUpper = basis + dev * 2
bbLower = basis - dev * 2

kcUpper = basis + ta.atr(20) * 1.5
kcLower = basis - ta.atr(20) * 1.5

squeezeOn = (bbUpper < kcUpper) and (bbLower > kcLower)
bgcolor(squeezeOn ? color.new(color.yellow, 85) : na)

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.