Double EMA (DEMA)
Double exponential moving average: an EMA with most of its lag removed, plotted on the price chart.
What you see
A single line on the price chart that reacts faster than an EMA of the same period. The first Period candles have no value.
How it is calculated
With N = Period and α = 2 / (N + 1):
EMA1 = EMA(close, N)EMA2 = EMA(EMA1, N), the EMA of the EMADEMA = 2 × EMA1 − EMA2
EMA2 lags behind EMA1 by roughly as much as EMA1 lags behind price; adding that difference back to EMA1 removes much of the lag. In this indicator both EMAs start at the first loaded close, which is why the first Period values are not shown.
How to read it
- Use it like an EMA with less lag: turns in the DEMA show up earlier.
- The price for the speed is overshoot: after sharp moves the DEMA can run past price for a moment, and in ranges it gives more false turns.
- Short DEMAs, such as the default 9, are mostly used as a fast signal line against a slower average.
Using it in strategies
Output: value (a price). In the Trade Setup use "Price vs line" or "Compare" it with a slower SMA or EMA. In WickScript use the built-in dema(source, length), e.g. dema(close, 9), or use indicator "DEMA" with period 9 as d and read d.value.
Settings
Open the settings with the slider icon next to the indicator (Indicators, F3). Numeric settings can be swept as Step 1 / Step 2 parameters when you run a strategy.
Inputs
| Setting | Type | Default | Description |
|---|---|---|---|
| Period | Number | 9 | Number of candles (N) for both EMAs. Uses the close of each candle. (min 1) |
Styles
| Setting | Type | Default | Description |
|---|---|---|---|
| Line Color | Color | #e0b310 |
Outputs
These values can be used in Trade Setup triggers, filters and exits (see Trade Setup) and in WickScript.
| Output | In WickScript | Description |
|---|---|---|
| value | value |
Use in WickScript
use indicator creates this indicator inside a script, with settings by their ID. Each output is a field of the name after as. See WickScript indicators.
wickscript 1
indicator "Double EMA (DEMA) from the list" on chart
use indicator "DEMA" with period 9 as myDema
show myDema.value as line "value"