# Exponential Moving Average (EMA)

> Moving average of the close that weights recent candles more heavily, so it reacts faster than a simple moving average.

Updated: 2026-10-25T00:01:52.000Z · https://chartrider.com/docs/indicators/ema/

## What you see
A single line on the price chart that follows price more closely than a simple moving average of the same period. The first value appears on the `Period`-th loaded candle.

## How it is calculated
With N = Period:
- Smoothing factor: `α = 2 / (N + 1)`.
- Start value: the simple average of the first N closes.
- Every following candle: `EMA = α × close + (1 − α) × previous EMA`.

Recent closes weigh most, and the weight of older closes decays step by step, so the EMA turns sooner than an [SMA](https://chartrider.com/docs/indicators/sma/). Because each value builds on the previous one, the first values after the start of the loaded data can differ slightly from a calculation with a longer history.

## How to read it
- The slope of the line and the position of price relative to it show the trend direction.
- Common pairs are 9/21 or 12/26 (the [MACD](https://chartrider.com/docs/indicators/macd/) is the difference of a 12 and a 26 EMA); 50 and 200 are used for the larger trend.
- In trends, pullbacks often find support or resistance near a short or medium EMA.
- The faster reaction also means more false crossings in sideways markets.

## Using it in strategies
Output: `value` (a price). In the [Trade Setup](https://chartrider.com/docs/strategies/trade-setup/), "Price vs line" works as a trend filter; as a trigger it fires when the close moves to the other side of the line. "Compare" checks it against a second EMA. In [WickScript](https://chartrider.com/docs/wickscript/) use `ema(source, length)`, e.g. `ema(close, 21)`, or a higher timeframe with `ema(close, 50) on 4h` (only closed 4h candles count). You can also load this indicator with `use indicator "EMA" with period 21 as fast` and read `fast.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 | `21` | Number of candles (N) that sets the smoothing factor α = 2 / (N + 1). Uses the close of each candle. (min 1) |

### Styles

| Setting | Type | Default | Description |
|---|---|---|---|
| Line Color | Color | `#7b55ea` |  |

## Outputs

These values can be used in Trade Setup triggers, filters and exits (see [Trade Setup](https://chartrider.com/docs/strategies/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](https://chartrider.com/docs/wickscript/indicators/).

```wickscript
wickscript 1
indicator "Exponential Moving Average (EMA) from the list" on chart
use indicator "EMA" with period 21 as myEma
show myEma.value as line "value"
```
