BACKTESTING · EMA CROSSOVER EXECUTION

EMA Crossover Backtest: Bar-Close Signals vs Next-Bar Execution

An EMA crossover signal is known only when the bar closes. Filling at that close, instead of the next open, flatters results in proportion to how far the open gaps.

Short answer

In an EMA crossover backtest, the cross is confirmed at bar close; a realistic fill is the next bar's open (plus slippage). Filling at the signal bar's close assumes you traded at a price that only became known at that instant, and filling at an intrabar cross assumes the cross held. On crypto, the next open usually equals the prior close on continuous markets, but slippage, spread and latency still apply; on fast bars the difference compounds over many trades. Compare the three models on identical signals.

Signal time vs execution time

Execution modelAssumptionNet avg (illustrative)
Intrabar cross priceCross held, filled instantly+0.41%
Next bar open + slippageRealistic+0.18%
Signal bar closeZero latency+0.24%
Ema Crossover: net avg by execution model (%)Ema Crossover: net avg by execution model (%): Intrabar cross price +0.41 %; Next bar open + slippage +0.18 %; Signal bar close +0.24 %.EMA CROSSOVER: NET AVG BY EXECUTION MODEL (%)Intrabar cross price+0.41 %Next bar open + slippage+0.18 %Signal bar close+0.24 %
Only next-bar or later is tradable. Original ChartsPod editorial graphic.

Where the difference comes from

Intrabar fills count crosses that later un-cross and fill at better prices; close fills skip spread and latency. On continuous crypto markets the next open is usually near the prior close, so most of the gap comes from slippage, spread and un-crossed signals.

Ema Crossover: one signal (illustrative)Ema Crossover: one signal (illustrative): BAR t: Signal forms intrabar; BAR t CLOSE: Signal confirmed; BAR t+1 OPEN: Realistic fill; COST: Gap + fees + slippage.BAR tSignal forms intrabarBAR t CLOSESignal confirmedBAR t+1 OPENRealistic fillCOSTGap + fees + slippage
The open can be far from the close. Original ChartsPod editorial graphic.

Break-even after realistic execution

ItemValue (illustrative)
Trades220
Gross avg per trade+0.30%
Fees (2 × 0.05%)−0.10%
Slippage (2 × 0.03%)−0.06%
Net avg per trade+0.14%
Break-even round-trip cost0.30%

Related: EMA in Crypto: Why the Value Changes Before Candle Close, RSI Mean Reversion Backtest: Bar-Close Signals vs Next-Bar Execution.

Test the ema crossover rule with next-bar fills in ChartsPod.

Open the ChartsPod terminal

Compare the three models on identical signals.

See EMA Crossover Backtest on live data in the free ChartsPod terminal.

Open the ChartsPod terminal

Questions readers ask

Why use next-bar fills for EMA crossovers?

The cross is known only at the close.

Is the next open far from the close in crypto?

Usually close, but slippage and spread apply.

What about intrabar crosses?

Many vanish by the close.

Sources and methodology

Backtest cost logic follows TradingView's Pine Script strategy documentation; indicator definitions are standard. All performance numbers are illustrative examples of the method, not results of real tests.

  1. TradingView Pine Script: Strategies — simulated fills and assumptions.
  2. TradingView Pine Script: Repainting — live vs historical calculation.
  3. ChartsPod documentation — guides for order flow, derivatives, alerts, backtests, journal and workspaces.
  4. TradingView Pine Script: Strategies — simulated fills and assumptions.
  5. TradingView Pine Script: Repainting — live vs historical calculation.

This article explains research tools and workflows. It is not financial advice, does not recommend buying or selling any asset and does not predict prices. Crypto derivatives carry a risk of rapid and total loss of margin.

CHARTSPOD EDITORIAL EDITION · RESEARCH AND EDUCATION ONLY · NOT FINANCIAL ADVICE.