Variable Keltner Channel For DCA
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © BrandonLimJH

//@version=5
indicator("Variable Keltner Channel For DCA", "DCA KC", true, timeframe="D")

// EMAs & ATR
EMA21 = ta.ema(close, 21)
EMA34 = ta.ema(close, 34)
ATR = ta.atr(10)


// Calculation
Bull_ATR = EMA21 - ATR * 1
Bear_ATR = EMA21 - ATR * 2

DCA_ATR = EMA21 > EMA34 ? Bull_ATR : Bear_ATR
ATR_Color = EMA21 > EMA34 ? color.new(color.green, 50) : color.new(color.red, 50)


// Plot
plot(DCA_ATR, "DCA KC", ATR_Color)
