OPEN-SOURCE SCRIPT

200 EMA with ATR Bands

158
//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")

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.