Exponential moving average calculator
Five readings that start at 10 and climb by one each step, smoothed with a factor of 0.5, end at an EMA of 13.0625: recent values count more and older ones fade geometrically. You get the whole smoothed path. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Series
- 10, 11, 12, 13, 14
- Factor
- 0.5
- N
- 5
- Ema
- 10, 10.5, 11.25, 12.125, 13.0625
- Last ema
- 13.0625
An exponential moving average (EMA) is a recursive smoother that multiplies the latest observation by a smoothing factor α and blends it with the previous EMA using weight (1 − α). Unlike a simple moving average that gives equal weight to every point inside a fixed window and zero weight outside it, the EMA remembers the entire history with geometrically decaying influence, so recent readings move the result more than distant ones.
What an exponential moving average is and why it differs from a simple average
Start from the simple moving average (SMA): pick a window length N, average the last N points, and slide the window forward. Every point inside the window has weight 1/N; every point older than N has weight zero. That hard cutoff is easy to explain but creates step changes when a large spike enters or leaves the window, and it ignores useful older information entirely.
The exponential moving average replaces the hard window with a single smoothing factor α between zero and one. Unrolling the recurrence shows that the weight on an observation k steps back is α · (1 − α)^k, a geometric series that never fully drops to zero yet decays quickly when α is large. When α is small the path is smooth and lag-heavy; when α is close to one the EMA hugs the latest value.
Traders often set α = 2 / (N + 1) so an “N-period EMA” has a comparable half-life to an N-period SMA, but the mathematical object only needs α itself. Analysts use EMAs on prices, volumes, sensor streams, web metrics, and residual noise because the update is O(1) per tick after the seed, needs only the previous EMA state, and has no look-ahead when applied online.
A plain arithmetic mean of the whole series is a different statistic: it treats the first and last observations equally and is not a filter over time. This tool is specifically the recursive EMA filter with an explicit α, not a rolling window mean and not the mean and variance of an exponential probability distribution.
What you can do with it
Price and return smoothers in trading notebooks
Quants and students compute EMA paths on close prices with an explicit α (or α from span N) to compare lag, noise, and crossover rules without spreadsheet formulas.
Sensor and operations metrics
Engineers smooth temperature, latency, or error-rate streams with a reactive α so dashboards highlight recent regime shifts while damping single-sample spikes.
FAQ
How do I convert an N-period EMA span into α?
A common convention is α = 2 / (N + 1). Pass the resulting α as factor; this tool does not take span alone.
Is the exponential moving average calculator free?
The browser tool runs free on your device.
How is the exponential moving average calculated?
The first EMA equals the first value. Each later EMA is the factor times the new value plus one minus the factor times the previous EMA, so every update needs only the last result.
What smoothing factor should I choose?
Reactive short filters often use values near 0.3 to 0.5, slow trend filters values near 0.05 to 0.1. A higher factor follows the latest value closely, a lower one gives a smoother path with more lag.
How is an EMA different from a simple moving average?
A simple moving average weighs every point in a fixed window equally and ignores older ones, which causes jumps when a spike enters or leaves. The EMA keeps the whole history with weights that shrink geometrically.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/stat/exponential-moving-average \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"series":[10,11,12,13,14],"factor":0.5}'const res = await fetch("https://api.kit.forhosting.com/stat/exponential-moving-average", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"series": [
10,
11,
12,
13,
14
],
"factor": 0.5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/stat/exponential-moving-average",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"series": [
10,
11,
12,
13,
14
],
"factor": 0.5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/stat/exponential-moving-average", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"series":[10,11,12,13,14],"factor":0.5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"series":[10,11,12,13,14],"factor":0.5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/stat/exponential-moving-average", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"series": [
10,
11,
12,
13,
14
],
"factor": 0.5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "stat.exponential_moving_average",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
This calculator takes a chronological series of finite numbers and a factor α in the open-closed interval (0, 1], seeds the path with the first observation, then applies EMA_t = α · x_t + (1 − α) · EMA_{t−1} for every later index. The response returns the full EMA array, the final last_ema, the series length n, the factor used, and a compact formula string. Empty series, non-finite entries, and factors outside (0, 1] fail with invalid_input so callers never receive a silent NaN. The arithmetic is fully deterministic, runs free in your browser, and is available over the API at $0.002 per successful request with no language model and no external market-data service on the hot path.
What an exponential moving average is and why it differs from a simple average
At each time step the new estimate is a convex combination of the new observation and the previous estimate: EMA_t equals α times x_t plus (1 − α) times EMA_{t−1}.
How this calculator validates input and builds the EMA path
Call the capability with two required fields: series (a non-empty array of finite numbers in chronological order, oldest first) and factor (the smoothing coefficient α). Validation rejects a missing field, a non-array series, an empty series, lists longer than the published maximum, any entry that is not a finite number, and any factor that is not a finite number strictly greater than zero and at most one. The engine also accepts aliases values, data, x, and prices for the series, and alpha, smoothing, and smoothing_factor for the factor, so scripts that already speak in those terms do not need a rename step. When the factor is out of range the error message says so explicitly under invalid_input, and validation failures do not consume prepaid balance. The response returns n, factor, series, ema, last_ema, and formula so downstream code can chart the path, assert the final level, or recompute intermediate steps without re-sending the request.
Practical use, factor choice, pricing, and delivery
Use the browser tool when you want an immediate EMA while checking a trading notebook, smoothing a noisy lab sensor, or explaining geometric weights in a statistics lesson without installing a package. Choose α from domain convention: short reactive filters use values near 0.3–0.5; slow trend filters use values near 0.05–0.1; the common span mapping α = 2 / (N + 1) turns a 9-period EMA into α = 0.2 and a 19-period EMA into α = 0.1. If you already store span N rather than α, convert once before calling. There is no language model, no external market feed, and no randomness, so the capability is safe to pin in continuous-integration checks and reproducible lesson materials. Each successful request is one billable item at $0.002; failed validation does not consume balance. Accepted series stay bounded for Worker isolates: up to one hundred thousand points cover classroom tables, daily price histories, and typical analytics excerpts while still finishing quickly. Results are fully deterministic: the same series and factor always yield the same ema array and last_ema. Wire the endpoint into charting helpers, quantitative tutorials, quality-control dashboards, coding-interview sandboxes, or preprocessing steps where you already prefer a closed-form EMA recurrence over opaque black-box smoothers that hide their seed rule or silently clamp α.
Integration use cases
Teaching recursive filters and geometric weights
Instructors and homework checkers show how EMA weights decay as (1 − α)^k and verify student implementations against a stable golden last_ema.
Technical questions
How do I compute an exponential moving average with this calculator?
Send JSON with series (array of numbers, oldest first) and factor (α in (0, 1]) to stat.exponential_moving_average. The response returns ema, last_ema, n, factor, series, and formula.
What formula does the EMA use?
EMA_0 = x_0; for t ≥ 1, EMA_t = α · x_t + (1 − α) · EMA_{t−1}, with 0 < α ≤ 1. Higher α weights recent points more.
What happens if the smoothing factor is out of range?
The request fails with invalid_input. α must be a finite number strictly greater than 0 and at most 1; values outside that range are rejected.