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.
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 — both testable as no-code rules.
EMA settings
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.
Example EMA strategies to backtest
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.
Enter long when the close crosses above the EMA. Exit when the close crosses below it.
Every rule above is buildable in the no-code strategy builder — pick conditions, press run, and get win rate, drawdown and 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.