# Double exponential moving average

`dema`

Exponential average with part of its lag removed.

## Inputs

| Name | Type | Default | Range |
| --- | --- | --- | --- |
| source | source | close |  |
| period | int | 14 | 1 to 5000 |

## Outputs

| Name | Kind |
| --- | --- |
| dema | value |

Warm-up: 2 * period - 2 bars (26 at the defaults).

Repaints: No.

## Formula

DEMA = 2 * EMA(x) - EMA(EMA(x))

The second average starts at the bar where the first is defined. After a gap the whole calculation starts again.
