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 model | Assumption | Net avg (illustrative) |
|---|---|---|
| Intrabar cross price | Cross held, filled instantly | +0.41% |
| Next bar open + slippage | Realistic | +0.18% |
| Signal bar close | Zero latency | +0.24% |
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.
Break-even after realistic execution
| Item | Value (illustrative) |
|---|---|
| Trades | 220 |
| 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 cost | 0.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 terminalCompare the three models on identical signals.
See EMA Crossover Backtest on live data in the free ChartsPod terminal.
Open the ChartsPod terminalQuestions 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.
- TradingView Pine Script: Strategies — simulated fills and assumptions.
- TradingView Pine Script: Repainting — live vs historical calculation.
- ChartsPod documentation — guides for order flow, derivatives, alerts, backtests, journal and workspaces.
- TradingView Pine Script: Strategies — simulated fills and assumptions.
- 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.