Backtesting & Optimization — Know What Your Strategy Really Does
We test your strategy the way it would trade live: realistic data and costs, robust optimization, and out-of-sample validation that exposes curve fitting before it costs you money.
Backtesting runs a trading strategy on historical data to estimate how it would have performed; optimization searches for the best parameters. ExpertNevees runs both with realistic spread, commission and slippage, MetaTrader 5 real-tick data or Python simulations, genetic optimization and walk-forward analysis, and reports robustness, drawdown and overfitting risk in a clear report.
What a Professional Backtest Includes
Data quality check
Realistic costs
Optimization
Walk-forward analysis
Monte Carlo and sensitivity
Decision-ready report
Metrics We Report and What They Mean
| Metric | Definition | How to read it |
|---|---|---|
| Profit factor | Gross profit ÷ gross loss | Above 1 means profitable before luck is considered. Meaningful only with enough trades. |
| Maximum drawdown | Largest peak-to-trough fall of equity | The pain you must be able to sit through. Compare with your risk tolerance. |
| Recovery factor | Net profit ÷ maximum drawdown | How well profit compensates for the worst fall. |
| Sharpe ratio | Average excess return ÷ return volatility | Return per unit of volatility. Sensitive to the return period used. |
| Expectancy | Average profit per trade | Must exceed costs by a safe margin. |
| Number of trades | Sample size | Few trades means any metric is unreliable. |
Computing Core Metrics From a Trade List in Python
import numpy as np
import pandas as pd
def summarize(trade_pnl: pd.Series, start_balance: float = 10_000.0) -> dict:
"""Core performance metrics from per-trade profit/loss in account currency."""
equity = start_balance + trade_pnl.cumsum()
peak = equity.cummax()
drawdown = peak - equity
wins = trade_pnl[trade_pnl > 0].sum()
losses = -trade_pnl[trade_pnl < 0].sum()
net = trade_pnl.sum()
max_dd = drawdown.max()
return {
"trades": int(len(trade_pnl)),
"net_profit": float(net),
"profit_factor": float(wins / losses) if losses > 0 else float("inf"),
"expectancy": float(trade_pnl.mean()),
"max_drawdown": float(max_dd),
"recovery_factor": float(net / max_dd) if max_dd > 0 else float("inf"),
"win_rate": float((trade_pnl > 0).mean()),
}
How Walk-Forward Analysis Protects You From Curve Fitting
Split history into windows
For example, a long in-sample period followed by a shorter out-of-sample period.
Optimize in-sample
Find the best parameters using only the in-sample window.
Test out-of-sample
Run those parameters on the next, unseen window and record the result.
Roll forward and repeat
Move both windows ahead and repeat across the whole history.
Judge the combined out-of-sample result
Only the stitched-together out-of-sample performance reflects what live trading may look like.
Backtest Traps We Look For
- ●Look-ahead bias: using data that was not yet available at the time of the decision.
- ●Overfitting: parameters tuned so tightly to history that they capture noise. Many tested combinations make a good-looking best result likely by chance.
- ●Unrealistic fills: zero spread, no slippage, or fills at prices that never traded.
- ●Poor data: synthetic ticks generated from bars can hide how a strategy behaves intra-bar. Real tick history is more faithful.
- ●Survivorship and regime bias: a test period that happens to suit the strategy and ignores different market regimes.
Delivery, Support & Guarantee
Timelines are indicative. The exact price and delivery date are confirmed in writing before work starts, with no hidden costs. Payment: 50% advance, 50% after your approval (USDT or bank wire).
Frequently Asked Questions
How accurate is MetaTrader Strategy Tester?
MT5 with real tick history, realistic spread and commission is a good approximation, but it is never exact: live slippage, requotes and liquidity differ. Treat results as an estimate and confirm with a forward test on demo.
What is the difference between backtesting and optimization?
Backtesting measures a fixed set of rules on history. Optimization searches many parameter sets for the best one, which raises the risk of overfitting if not validated out of sample.
What is walk-forward analysis?
It repeatedly optimizes on one period and tests on the following unseen period, then rolls forward. It measures whether the optimization process generalizes.
Can you backtest a strategy that is not yet an EA?
Yes. We can simulate rules in Python first and build the EA afterwards. See Expert Advisor Development.
How many trades do I need for a reliable result?
More is better. A common rule of thumb is hundreds of trades across different market conditions, but it depends on the strategy’s variance. We report confidence in the sample.
Do you also test AI models?
Yes, with time-ordered validation and leakage checks. See AI Trading System Development.
Official Documentation & Sources
- Testing Trading Strategies — MetaTrader 5 HelpMetaTrader5.comView Docs ↗
Find Out If Your Strategy Is Robust or Just Lucky
Send the EA or the rules. We test it with realistic assumptions and report honestly.