indicator · on price · open source
Double Exponential Moving Average
Running…
Loading chart…
About
Double EMA (DEMA) subtracts a double-smoothed EMA from a doubled single EMA to cancel out the inherent EMA lag. Faster turns than a comparable EMA with the same smoothing length.
- Use DEMA where lag is hurting a fast EMA crossover.
- Raise N for steadier lines; lower it for snappy turn detection.
- Adds noise in chop — pair with an ADX filter.
Source code
//@version=5
indicator("Double Exponential Moving Average", overlay=true)
len = input.int(20, "Length", minval=1, maxval=500)
src = input.source("close", "Source")
e1 = ta.ema(src, len)
e2 = ta.ema(e1, len)
dema = 2 * e1 - e2
p_DEMA = plot(dema, "DEMA", color=color.red, linewidth=2)
alertcondition(ta.crossover(close, dema), "Price crosses above DEMA", "Price crossed above the DEMA")
alertcondition(ta.crossunder(close, dema), "Price crosses below DEMA", "Price crossed below the DEMA")
No comments yet.
Sign in to comment.