Exponential Moving Average (EMA)
Moving average of the close that weights recent candles more heavily, so it reacts faster than a simple moving average.
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. 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 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, "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 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) 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 "Exponential Moving Average (EMA) from the list" on chart
use indicator "EMA" with period 21 as myEma
show myEma.value as line "value"