What EA Optimization Actually Solves
Optimization tests ranges of an Expert Advisor's input parameters across historical data to check whether strategy behavior aligns with a symbol's volatility and session characteristics. Its true goal is discovering stable parameter regions (plateaus) that survive changing conditions—not maximizing past backtest profit to unrealistic heights.
Define Your Objective Metric Before Starting
Avoid sorting optimization tables solely by Net Profit, which rewards excessive lot sizing and fragile edge cases. Prefer balanced criteria such as:
- Recovery Factor or Custom Criterion: Balances total return against maximum equity drawdown.
- Minimum Trade Count Floor: Discard any pass generating too few trades (e.g., under 150 trades over several years) to be statistically meaningful.
- Fixed Risk Per Pass: Keep lot sizing fixed (e.g.,
0.01lots) during optimization so compounding math does not distort parameter quality.
Step-by-Step Anti-Overfitting Optimization Workflow
- Establish a Baseline: Run a standard single test with default settings and record drawdown, trade count, and profit factor.
- Select 2–4 Core Inputs Only: Restrict optimization to logically meaningful inputs (such as ATR multiplier, trend period, or session end hour). Optimizing 12 inputs simultaneously guarantees curve fitting.
- Use Broad, Sensible Step Sizes: Instead of testing every integer from
10to20in steps of1, step meaningfully (e.g.,10, 15, 20, 25, 30) to lower search degrees of freedom. - Choose Plateaus Over Isolated Spikes: Look at 2D heatmaps or neighboring passes. If period
20wins while15and25lose money, reject20as a statistical fluke; choose zones where adjacent parameters stay consistently positive. - Validate Out-of-Sample (Walk-Forward): Run the selected preset across an untouched recent 20%–30% date window and verify live-spread demo execution afterward.
Warning Signs of Overfitted EA Settings
- A single narrow input combination outperforms every neighboring value dramatically.
- Out-of-sample performance collapses immediately compared to the in-sample optimization window.
- Tightly sculpted trading hours skip random specific minutes of the day (e.g., disabling 14:15–14:30 purely to dodge two historical losses).
ACTION CHECKLIST
- Record baseline performance: Run a single real-tick test using default settings to establish a benchmark.
- Limit parameters and fix lot sizing: Select only 2–4 logical strategy inputs and hold lot size constant during optimization.
- Run optimization with realistic trading costs: Test across multi-year in-sample data with real spreads, commissions, and minimum trade count filters.
- Select parameter plateaus, not spikes: Pick inputs surrounded by healthy neighboring passes rather than isolated profit peaks.
- Validate out-of-sample and forward-test: Test the winning preset on unseen walk-forward dates and verify on a live-feed demo account.