OPEN-SOURCE SCRIPT
200 EMA with ATR Bands

//version=6
indicator("200 EMA with ATR Bands", overlay=true)
// === Inputs ===
emaLength = input.int(200, "EMA Length", minval=1)
atrLength = input.int(14, "ATR Length", minval=1)
atrMult = input.float(1.5, "ATR Multiplier", step=0.1, minval=0.1)
emaColor = input.color(color.yellow, "EMA Color")
bandColor = input.color(color.new(color.teal, 80), "Band Fill Color")
// === Calculations ===
ema200 = ta.ema(close, emaLength)
atrVal = ta.atr(atrLength)
// Bands based on ATR
upperBand = ema200 + atrVal * atrMult
lowerBand = ema200 - atrVal * atrMult
// === Plot ===
plot(ema200, title="200 EMA", color=emaColor, linewidth=2)
pUpper = plot(upperBand, title="Upper ATR Band", color=color.new(color.teal, 0))
pLower = plot(lowerBand, title="Lower ATR Band", color=color.new(color.teal, 0))
// Fill the band region
fill(pUpper, pLower, color=bandColor, title="ATR Band Fill")
indicator("200 EMA with ATR Bands", overlay=true)
// === Inputs ===
emaLength = input.int(200, "EMA Length", minval=1)
atrLength = input.int(14, "ATR Length", minval=1)
atrMult = input.float(1.5, "ATR Multiplier", step=0.1, minval=0.1)
emaColor = input.color(color.yellow, "EMA Color")
bandColor = input.color(color.new(color.teal, 80), "Band Fill Color")
// === Calculations ===
ema200 = ta.ema(close, emaLength)
atrVal = ta.atr(atrLength)
// Bands based on ATR
upperBand = ema200 + atrVal * atrMult
lowerBand = ema200 - atrVal * atrMult
// === Plot ===
plot(ema200, title="200 EMA", color=emaColor, linewidth=2)
pUpper = plot(upperBand, title="Upper ATR Band", color=color.new(color.teal, 0))
pLower = plot(lowerBand, title="Lower ATR Band", color=color.new(color.teal, 0))
// Fill the band region
fill(pUpper, pLower, color=bandColor, title="ATR Band Fill")
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.