Optimization should search for settings that remain useful when market conditions change. It should not search for the most attractive historical equity curve. The goal is a stable region of acceptable results, supported by untouched data and realistic costs.
Define success before running optimization
Choose an objective that reflects how the EA should behave, not net profit alone. Maximum drawdown, trade count, average trade, profit factor, recovery profile and exposure all matter. A pass with exceptional profit but unacceptable drawdown or only a handful of trades is not a robust candidate.
Maximizing profit alone may reward excessive risk, a single favourable period or settings that trade too infrequently to evaluate.
Separate development data from validation data
Divide history chronologically. Use the first segment for exploration, keep a later segment untouched for out-of-sample validation, and then observe the chosen settings on current forward demo data. Do not repeatedly inspect the validation period and tune against it; once that happens, it has quietly become part of the training set.
Test sensible parameter ranges and understand behaviour.
Check the rules on a period not used for selection.
Confirm current signals, costs and execution on demo.
A practical MT4 optimization workflow
Choose parameters with a logical role
Optimize only variables that plausibly affect entries, exits or risk. Keep fixed values fixed. Testing every available input multiplies the number of combinations and the chance of discovering noise.
Use broad, meaningful ranges
Start with coarse steps and realistic limits. If only one exact value works, the system is fragile. Neighbouring values should produce reasonably similar behaviour.
Filter by risk and sample quality
Reject passes with unacceptable drawdown, too few trades, implausible position size or results dominated by one short period. Then compare the surviving cluster rather than ranking every pass by profit.
Lock the settings and validate
Choose the settings before opening the untouched period. Record the EA build, symbol, timeframe, spread, deposit, data dates and every input so the result can be reproduced.
Stress-test the selected region
| Test | Question | Healthy behaviour |
|---|---|---|
| Neighbouring inputs | Does a small parameter change break the system? | Results degrade gradually, not catastrophically. |
| Higher spread | Is the edge consumed by trading costs? | The logic remains viable under a realistic buffer. |
| Shifted dates | Does one market regime create the whole result? | Several periods contribute rather than one cluster. |
| Delayed execution | Is the strategy dependent on perfect fills? | Moderate slippage does not reverse the conclusion. |
| Lower risk | Is performance only attractive at excessive exposure? | Trade logic remains coherent at conservative sizing. |
Know when to reject an optimization
- The best pass is an isolated spike surrounded by poor results.
- Most profit comes from one trade or one short period.
- Out-of-sample drawdown expands sharply or trade behaviour changes completely.
- Small increases in spread or slippage erase the edge.
- The selected lot size is incompatible with the planned account risk.
Optimization cannot prove future profitability. It can only help eliminate weak assumptions and identify settings that deserve further observation.
Official reference
MetaTrader describes optimization as repeated Strategy Tester passes with different inputs in its official Expert Optimization documentation.