AlgoVerdict

How to Backtest & Forward-Test an EA Properly

Last updated: 04 June 2026

Why most backtests lie

An EA showing 200% annual return at 10% drawdown in backtesting sounds like the Holy Grail. In live trading it collapses within three months. The broker is rarely to blame — the culprit is almost always curve-fitting: the EA was unknowingly optimised on the test history, not for the future.

Rigorous testing means systematically filtering out this bias. The steps below apply to both MT4 and MT5; the underlying principles hold across platforms.

Step 1: Choose your data source

The quality of a test is only as good as its tick data.

MT5 downloads tick data directly from the broker — quality varies by provider. For a reliable baseline, import from an independent source such as Dukascopy, which provides gapless 1-tick history.

MT4 works internally with M1 bars and interpolates ticks. The "Every tick (based on real ticks)" model improves quality somewhat, but is not a true tick import. For latency- or spread-sensitive EAs, use MT5 or a dedicated backtesting solution (Soft4FX, TickStory).

Before every test run, check:

Step 2: Model realistic costs

A backtest without accurate costs is worthless.

Step 3: Separate in-sample from out-of-sample

In-sample (IS): the data on which you optimise.
Out-of-sample (OOS): the untouched remainder on which you validate.

A practical rule of thumb: 70% IS, 30% OOS. The critical point is to set the OOS period aside before optimising, then test on it exactly once. If you run multiple optimisation passes on the OOS window you effectively turn it into a second IS set.

Step 4: Walk-forward analysis

The walk-forward test generalises the IS/OOS principle across rolling windows:

  1. Optimise on window 1 (e.g. 6 months).
  2. Test the best parameters on window 2 (e.g. 3 months).
  3. Slide the window forward and repeat — typically 5–10 cycles.

If the EA stays consistently profitable across all OOS windows (even if absolute returns are lower), that is a considerably stronger signal than a single polished backtest. Tools like the MT5 walk-forward optimiser or third-party solutions such as Adaptrade make this process manageable.

Step 5: Robustness checks — beyond optimisation

Beyond walk-forward, additional robustness tests are worth running:

Step 6: Forward-test in live conditions

No backtest replaces the real market. After passing the OOS test, run the EA on:

  1. Demo account — free, but without real execution quality.
  2. Live micro-lot (0.01 lot) — low-cost real-market test; slippage and true spread become visible.

A valid forward test needs at least 100–300 trades or 3–6 months, whichever comes first. Only then are drawdown and edge claims statistically meaningful.

For a reliable forward test, stable uptime is essential — that is what a VPS provides. For which brokers offer the best conditions for realistic testing (tight spreads, honest execution), see our broker reviews.

The most common mistakes

MistakeConsequence
Only "Every tick" on broker dataUnrealistic ticks, results too good
Spread fixed at minimumUnderestimated costs, overfitted strategy
Multiple optimisation passes on OOSOOS effectively becomes IS
Too many parametersHigh overfitting probability
Forward test on demo onlyNo real execution feedback

Conclusion

A sound EA test rests on three pillars: genuine tick data with realistic costs, a clean OOS window, and a live forward test on a micro-lot account. The walk-forward test is the strongest tool against overfitting. Anyone who maintains this discipline protects themselves against the most expensive mistake in algo trading: putting real money into a curve-fitted system.

Frequently asked questions

Why is a good backtest report not enough on its own?

Backtests fit parameters to historical data. The more parameters you test, the higher the probability of a chance hit (overfitting). Only a clean out-of-sample window followed by a live forward test can show whether the edge is real.

What tick data quality do I need for MT4/MT5?

For strategies close to scalping you need 99% tick data — for example from a Dukascopy import or MT5's own tick download. The 'Every tick' model in MT4 using the broker's own data is often insufficient for realistic testing.

What is a walk-forward test?

You divide the price history into consecutive segments. On segment N you optimise; on segment N+1 you test — untouched by the optimisation. The cycle repeats several times. If the parameters stay stable across all out-of-sample windows, that is a strong signal of robustness.