Double exponential moving average
All indicators

LibraryTrend

Indicator

Double exponential moving average

Patrick Mulloy's double exponential average, which removes part of the lag of an ordinary EMA.

TrendOn the price2 inputsDEMA

How it is calculated

Twice the EMA of the source minus the EMA of that EMA, both with the same length. Each EMA is seeded with the simple average of its own first length inputs, so the second starts length minus 1 bars after the first and the first value needs 2 times length minus 1 bars, as TA-Lib's DEMA.

Reference: TA-Lib DEMA (Mulloy 1994)

How to read it

Read like an EMA, but it follows price more closely and turns sooner; the cost is more overshoot at turns and more false signals in a range. Despite the name it is not an EMA applied twice.

In a strategy

A quicker trend line, ctx.ind("dema", length=20), with a cross of the close over it as entry trigger and a slower average as filter.

Inputs

InputTypeDefaultRange or choices
LengthlengthWhole number20min 1, max 5000
SourcesourcePrice"close"close, open, high, low, hl2, hlc3, ohlc4, hlcc4

What it draws

LineDrawn as
DEMALine

Used in

No strategy template reads it yet.

OrionQuant