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

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.