A moving average that weights recent prices more heavily, so it tracks current price more closely than a simple average — at the cost of slightly noisier output.
EMA(20) tracking price on MES 5m
What it measures
- Trend direction. A rising EMA means recent closes are higher than the trailing average; a falling EMA means the opposite.
- Smoothed price reference. Used as a dynamic support/resistance level in trending markets.
- Momentum acceleration. The EMA's slope is non-trivial — it tells you whether the trend is gaining or losing pace.
Formula
How AlgoLift computes it
EMA[i] = (price[i] − EMA[i−1]) × α + EMA[i−1] where α = 2 / (period + 1).
The first EMA value is seeded with a Simple Moving Average over the first period bars to give the recursion a starting anchor. Every subsequent bar updates the previous EMA toward the new price by a fraction α.
A 20-period EMA has α ≈ 0.0952, meaning roughly 9.5% of each new bar's price flows into the EMA. A 5-period EMA has α ≈ 0.333 — much more responsive. A 200-period EMA has α ≈ 0.0099 — barely moves on any single bar.
Inputs in AlgoLift
| Setting | Default | Range | Notes |
|---|---|---|---|
| Period | 20 | 1–500 | Lookback in bars. Lower = faster + noisier; higher = slower + smoother. |
Recommended periods
- 5–9 (fast): Short-term scalping; very responsive but produces many false crossovers.
- 20 (default): Balanced for intraday day-trading. The most common "fast" EMA in pairs.
- 50 (medium): Common "slow" EMA in 20/50 crossover systems. Reasonable trend filter on 5m–15m bars.
- 200 (slow): Long-term regime filter. The "above or below 200-EMA" question is one of the cleanest trend tests available.
Outputs in AlgoLift
| Handle | Type | Plotted | Notes |
|---|---|---|---|
| EMA Value | Numeric | Always | The EMA line itself. Comparable directly to price. |
| Slope | Numeric | On select | Difference between this bar's EMA and the previous bar's. Positive = rising EMA, negative = falling. |
EMA node — default state with both outputs visible
How to read it
- Price above EMA: Recent closes are higher than the trailing weighted average. Generally interpreted as an up-state for the chosen period.
- Price below EMA: Recent closes are lower than the trailing weighted average. Down-state.
- Rising EMA slope: Up-state is strengthening — momentum building.
- Falling EMA slope: Up or down-state is weakening — momentum fading.
- EMA crossover: A fast EMA crossing above a slow EMA is the canonical "trend change" signal; crossing below is the inverse.
EMA reacts faster than SMA but slower than DEMA or TEMA. The trade-off is responsiveness vs. noise resistance — a 20-EMA will cross several times during a choppy session that a 20-SMA stays roughly flat through.
EMA's value is its responsiveness-to-smoothness ratio. Faster than SMA, slower than DEMA — the default choice when you don't have a specific reason to pick something else.
Best in / worst in
Best in trending markets and on instruments with consistent volatility (ES, MES, NQ during regular hours). The smoothing eats short-term noise while still tracking real direction.
Worst in sideways chop and during low-liquidity windows. Crossover strategies on a single EMA pair will machine-gun trades when price oscillates around the average — see the Cooldown pattern below.
Three setups
1. Two-EMA crossover
The canonical entry signal: fast EMA crosses slow EMA.
- Long: EMA(20) crosses above EMA(50) AND a Cooldown condition requires EMA(20) to have dropped back below EMA(50) before re-entering.
- Short: EMA(20) crosses below EMA(50) with the inverse cooldown.
Without the cooldown, this strategy fires every bar both EMAs are crossed and is unusable. See your first strategy for the full wiring.
Two-EMA crossover with cooldown
2. EMA as a trend filter
Use a slow EMA to gate signals from a different indicator.
- Long: Only allow long entries when price > EMA(50). Pair with an oscillator like RSI for the actual entry trigger.
- Short: Only allow short entries when price < EMA(50).
This is the single most common use of EMA in production strategies — not as a signal itself, but as the regime check on someone else's signal.
3. EMA pullback entry
Wait for price to retest a rising EMA in an established uptrend.
- Long: EMA(50) slope is positive (uptrend confirmed) AND price has touched within 1 ATR of the EMA in the last 5 bars.
- Short: Symmetric.
The pullback pattern improves R:R versus chasing breakouts but requires more nuance — see momentum strategies for the variations.
Advanced patterns in AlgoLift
Volatility-scaled trailing stop with EMA-based entry. Wire your EMA crossover into Entry, then feed an ATR value × 1.5 into Set Stop Loss. The stop tightens in calm sessions and widens in volatile ones automatically — a more robust exit than fixed-distance stops. See position sizing for the math.
EMA slope as a regime filter. Wrap the EMA's Slope output in a ROC Modifier if you want acceleration, or compare slope directly against zero. Positive slope = trend-up regime, allow long entries only. Negative slope = trend-down regime, allow short entries only. See market regimes.
Multi-timeframe EMA confirmation. Add a second data series at a higher timeframe (e.g., 60m alongside your 5m execution chart). Gate your 5m entries with an AND condition requiring the 60m EMA(20) slope to be positive. Trades only fire when the higher-timeframe trend confirms — significantly reduces false signals in chop. See the multi-series Visual Builder pattern.
Multi-timeframe EMA confirmation — 60m gate on 5m entries
Common mistakes
- Treating EMA crossovers as standalone signals. Without a trend filter or cooldown, crossover systems lose money in chop. The crossover is the alert; the filter is what makes it tradable.
- Optimizing the period too tightly. A strategy that works at EMA(20) but fails at EMA(19) or EMA(21) is fit to a coincidence. See overfitting in trading for the diagnostic.
- Comparing EMAs across different timeframes without rebasing. The EMA(20) on a 5m chart and EMA(20) on a 1h chart measure entirely different things. Use distinct named series and label them clearly.
- Ignoring the slope. The EMA value tells you where the trend is; the slope tells you whether the trend is alive or dying. Most users wire only Value and miss half the information.