What is OVERFITTING? and how to know if an EA optimization and backtesting result is overfitted?

July 22, 2025 by
What is OVERFITTING? and how to know if an EA optimization and backtesting result is overfitted?
Quantalpha Algorithms
| No comments yet

What is overfitting? and how to know if an EA optimization and backtesting result is overfitted?

Overfitting occurs when an Expert Advisor (EA) is too closely tailored to past historical data, capturing random patterns or noise instead of robust market behavior. This makes the EA perform exceptionally well during backtesting or optimization, but fail to perform in live trading or unseen data.

In MQL5, this usually happens when:

  • You over-optimize input parameters using the Strategy Tester.
  • You rely too much on fitted conditions without validating robustness.
  • You focus only on in-sample performance.

-----

Yes, there are no single definitive metrics for overfitting, but several indicators and methods help detect it. Here’s a concise breakdown:

🔍 How to Know if an EA is Overfitted (Metrics & Methods)

Key Metrics to Watch:

  1. Out-of-Sample vs In-Sample Performance
    • Metric to compare: Profit, Drawdown, Sharpe Ratio
    • 🔴 Red flag: Big drop in performance on out-of-sample data

  2. Sharpe Ratio
    • A very high value (e.g., 10+) may indicate curve-fitting.
    • ✔️ Good: 1.5 to 3
    • ⚠️ Too good to be true: 5 or more (unless strategy is tested across multiple conditions)

  3. Profit Factor
    • ✔️ Healthy range: 1.5–3
    • ⚠️ Over 5 may be suspicious unless proven on out-of-sample or live data.

  4. Recovery Factor
    • Compares net profit vs. drawdown.
    • ✔️ >2 is good, but if it's too high (>10) and only in-sample, investigate further.

  5. Number of Trades
    • ✔️ Overfitting is more likely with low trade count (e.g., <50 trades).

  6. Parameter Sensitivity
    • Test the strategy with slightly altered inputs.
    • 🔴 If performance drops drastically, the EA may be overfit.

🔁 Best Practices to Detect Overfitting

  • Out-of-Sample Testing
  • Walk-Forward Analysis
  • Monte Carlo Simulation
  • Robustness Testing (across timeframes/pairs)

📌 Summary:

"There’s no single magic metric, but if your EA only performs well in-sample, has extreme metrics (e.g., Sharpe > 10), is highly sensitive to inputs, and fails in live or unseen data — it’s likely overfitted."

✅ Tip:

"A good EA is one that performs consistently across different market conditions — not just one that looks perfect on a backtest."

Share this post
Sign in to leave a comment