# dema {#dema}

## Syntax {#syntax}

`dema(X, window)`

Please see [TA-Lib Functions](../Themes/TALib.md) for the parameter description and windowing logic.

## Details {#details}

Calculate the Double Exponential Moving Average \(dema\) for *X* in a sliding window of the given length.

The formula is:

![](../../images/ema1.png)

![](../../images/dema.png)

## Examples {#examples}

```
x=12.1 12.2 12.6 12.8 11.9 11.6 11.2
dema(x,3);
// output: [,,,,12.091666666666668,11.689583333333335,11.266666666666665]

x=matrix(12.1 12.2 12.6 12.8 11.9 11.6 11.2, 14 15 18 19 21 12 10)
dema(x,3);
```

|col1|col2|
|----|----|
|||
|||
|||
|||
|12.0917|20.9444|
|11.6896|14.6806|
|11.2667|10.9444|

Related functions: [ema](../e/ema.md), [tema](../t/tema.md)

