# Triple exponential moving average

`tema`

Exponential average with most of its lag removed.

## Inputs

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

## Outputs

| Name | Kind |
| --- | --- |
| tema | value |

Warm-up: 3 * period - 3 bars (39 at the defaults).

Repaints: No.

## Formula

TEMA = 3 * EMA(x) - 3 * EMA(EMA(x)) + EMA(EMA(EMA(x)))

Each average starts at the bar where the one before it is defined. After a gap the whole calculation starts again.
