Skip to content
CandleTest
Backtests run in your browser
Trend indicator

EMA backtesting — Exponential Moving Average

The Exponential Moving Average (EMA) is a trend line that weights recent closes more heavily than older ones, so it reacts to new price action faster than a simple average. It is a core building block of crossover systems and trend filters — how well it works is a question of settings and market regime, best answered by testing.

BTC/USDT · 4h · Binance · Aug 17, 2026 – Sep 19, 2026 · default settings

How EMA works

EMA applies a smoothing factor derived from the chosen length to blend the previous EMA value with the newest close, giving exponentially decreasing weight to older data. The effect is a line that turns sooner than an SMA of the same length after a price shift, at the cost of reacting to more short-term noise. CandleTest’s EMA follows TradingView-parity conventions for the smoothing formula, so values match candle-for-candle. Traders use EMA as a trend filter — price crossing above or below the line, optionally paired with the EMA’s own slope for confirmation — and in crossover systems, where a fast EMA crossing a slow one is the signal. All of these are testable as no-code rules.

EMA settings

Length1–50020

The smoothing window. Shorter lengths make the EMA hug price and react almost immediately to new moves; longer lengths produce a slower, steadier trend line with fewer whipsaws.

Outputs: EMA

Example EMA strategies to backtest

EMA slope trend filter

Enter long when the close crosses above the EMA and the EMA is rising. Exit when the close crosses back below the EMA, or when the EMA turns to falling.

Build it on BTC/USDT →

Price-vs-EMA trend filter

Enter long when the close crosses above the EMA. Exit when the close crosses below it.

Build it on BTC/USDT →

Golden cross

Add two EMAs, 50 and 200. Enter long when the EMA 50 crosses above the EMA 200; exit when it crosses back below — the classic golden cross and death cross.

Build it on BTC/USDT →

Every rule above is buildable in the no-code strategy builder — compare a line with a value, with price or with another indicator, add an optional stop-loss or take-profit, press run, and get win rate, drawdown and an equity curve on real exchange data with fees and leverage modeled.

EMA FAQ

What EMA length works best for a trend-following rule?

There is no fixed length that works across every market — the right value depends on the pair, timeframe, and how much lag versus noise you can tolerate. Backtest a price-crosses-EMA rule across a range of lengths on the exact market you trade rather than assuming a popular default will transfer.

Why does EMA react faster than SMA?

Because EMA weights the most recent closes more heavily, while SMA weights every candle in the window equally. That makes EMA turn sooner after a price shift but also more prone to reacting to short-lived noise, which a backtest will expose as more frequent, smaller-edge signals.

Does an EMA trend rule work in ranging markets?

Generally not well — a price-crosses-EMA rule is trend-following by design and tends to generate repeated false signals when price chops sideways around the line. Backtesting the exact rule over a ranging period is the way to see how large that drag actually is.

Is CandleTest’s EMA the same as TradingView’s?

Yes — the smoothing formula follows TradingView conventions and is unit-tested for parity, so the same candle and settings produce the same EMA value on both platforms.

Related indicators