An Expert Advisor (EA) is an automated trading system designed to execute trades based on pre-programmed rules. EAs operate on the MetaTrader 5 (MT5) platform, removing the need for manual intervention by analysing market conditions and placing trades automatically.
Traders use EAs to ensure their trading strategies’ precision, efficiency, and discipline.
While an EA can execute trades effectively, its performance heavily depends on how well it is configured. Market conditions change over time, meaning an EA that worked well in the past may not remain profitable.
Optimisation is the process of fine-tuning an EA’s parameters to adapt to different market conditions, enhancing its profitability and stability.
Without optimisation, an EA may:
MT5 provides a powerful Strategy Tester tool, which allows traders to backtest and optimise their EAs. This tool simulates trading based on historical data to determine how an EA would have performed under different conditions.
Key features of the MT5 Strategy Tester include:
By understanding the importance of EA optimisation and how the MT5 Strategy Tester works, traders can fine-tune their automated strategies to achieve better performance and adapt to changing markets.
Optimisation in MT5 refers to systematically adjusting an Expert Advisor’s (EA) parameters to improve performance. The goal is to identify the best possible settings that maximise profitability, reduce drawdowns, and improve trading consistency.
The MT5 Strategy Tester allows traders to run multiple backtests using different combinations of input parameters, evaluating the EA’s performance under historical market conditions. By doing so, traders can find optimal settings that align with their trading goals.
While both backtesting and optimisation are essential for EA development, they serve different purposes:
Feature | Backtesting | Optimisation |
Purpose | Tests the EA’s performance using a fixed set of parameters. | Finds the best combination of parameters for optimal performance. |
Execution | Runs a single test based on past data. | Runs multiple tests with different parameter settings. |
Time Required | Relatively fast, as only one test is performed. | Can be time-consuming, especially with large datasets. |
Outcome | Provides a performance report with key statistics. | Identifies the best parameter set based on selected criteria. |
Optimising an EA is essential for improving its trading efficiency and adapting it to various market conditions. Some key benefits include:
Proper preparation is crucial before running an optimisation in MetaTrader 5 (MT5). A well-prepared setup ensures reliable results and prevents common pitfalls like overfitting. Traders must select the right EA, set up historical data, choose the best trading pairs and timeframes, and configure EA parameters for optimisation.
Not all Expert Advisors (EAs) are designed for optimisation. Some may have hard-coded parameters that cannot be adjusted, while others may require manual input for certain conditions. Before optimising, you must ensure:
If an EA lacks flexibility, optimisation won’t be effective.
The accuracy of optimisation depends on the quality of historical price data. If the data is incomplete or low-quality, optimisation results may not reflect real market conditions.
Steps to Set Up High-Quality Historical Data:
Download historical data from Symbols options in MT5
The effectiveness of an EA depends on the currency pair or asset being traded and the timeframe in which it operates.
The timeframe selection depends on the EA’s trading style:
Trading Style | Recommended Timeframe |
Scalping | M1, M5, M15 |
Intraday | M15, M30, H1 |
Swing Trading | H4, D1 |
Long-Term | D1, W1 |
If unsure about the timeframes, start with H1 and then refine based on results.
Before optimisation, define which EA settings to optimise and which to keep fixed.
Types of Parameters to Optimize
Setting Parameter Ranges
Optimisation requires defining minimum, maximum, and step values for each parameter.
Parameter | Min Value | Max Value | Step |
Take Profit (TP) | 20 pips | 100 pips | 5 pips |
Stop Loss (SL) | 10 pips | 50 pips | 5 pips |
Lot Size | 0.1 | 1.0 | 0.1 |
Moving Average Period | 10 | 100 | 5 |
Traders must use logical ranges—too many values slow down optimisation, while too few reduce accuracy.
The MT5 Strategy Tester is a powerful tool for optimizing Expert Advisors (EAs). It allows traders to test multiple parameter combinations, simulate real market conditions, and determine the most effective settings.
To access the MT5 Strategy Tester:
The interface consists of several sections:
Section | Purpose |
EA Selection | Choose the EA to optimise. |
Symbol & Timeframe | Select the currency pair and timeframe for testing. |
Model Selection | Choose how price data is simulated (tick, OHLC, etc.). |
Optimisation Mode | Select whether to use a full or genetic algorithm. |
Parameter Settings | Define which inputs will be optimised and their range. |
Execution Settings | Set deposit amount, leverage, and spread conditions. |
Results Tab | View the performance of different parameter combinations. |
Strategy Tester options in MT5 (EN)
Strategy Tester options in MT5 (TC)
Strategy Tester options in MT5 (SC)
MT5 offers two primary optimisation modes:
1. Slow (Full) Optimization: It tests all possible combinations of input parameters and provides the most accurate results but is time-consuming. It is suitable for small parameter ranges or when high accuracy is needed.
2. Fast Genetic Algorithm (GA) Optimization: It uses machine learning techniques to find the best settings, prioritises high-performing parameter combinations and eliminates weaker ones. It is much faster than full optimisation and is ideal for large parameter ranges.
It is recommended that the Genetic Algorithm be used first to identify promising settings, then refined with Full Optimization.
To optimise an EA, define which parameters should change and set their ranges:
MT5 provides different testing models for optimisation. The choice depends on speed vs. accuracy.
Testing Model | Speed | Accuracy | Best Use Case |
Every Tick | Slow | High | Scalping & precise strategies |
1-Minute OHLC | Medium | Medium | Swing & intraday trading |
Open Prices Only | Fast | Low | Initial quick testing |
For scalping EAs, use “Every Tick”; for a balanced speed and accuracy, use “1-Minute OHLC”.
For realistic optimisation, ensure market conditions reflect real trading scenarios.
1. Spread Settings: While optimising, you can use fixed or variable spreads. You can also set a realistic spread or use the current speed for a real-market simulation.
2. Slippage Settings: It accounts for order execution delays. You must set a reasonable value (e.g., 2-3 pips for volatile markets).
3. Initial Deposit & Leverage: You must set a realistic deposit amount and leverage (e.g., $10,000 with 1:100).
Once the Expert Advisor (EA) optimisation process in MetaTrader 5 (MT5) is complete, the next step is to analyse the results to ensure the selected parameters offer a balance of profitability, stability, and risk control.
MT5 provides several key metrics in the Optimization Results tab. Each of these metrics helps evaluate the EA’s overall performance.
Metric | Description | Ideal Value |
Net Profit | Total profit after losses | Higher is better, but not the only indicator |
Drawdown (%) | Maximum drop in balance/equity | Below 20% for low risk |
Profit Factor (PF) | Ratio of gross profit to gross loss | PF > 1.5 is good, >2.0 is excellent |
Win Rate (%) | Percentage of profitable trades | 40-60% is acceptable if R:R is high |
Expected Payoff | Average profit per trade | Higher is better |
Sharpe Ratio | Risk-adjusted return | Above 0.5 is acceptable, above 1.0 is excellent |
Recovery Factor | Net profit ÷ max drawdown | Above 3.0 is strong |
Stability Factor | Measures consistency | The closer to 1.0, the better |
After running optimisation, MT5 ranks parameter combinations based on net profit by default. However, blindly choosing the most profitable result can be risky.
Overfitting happens when an EA is optimised too specifically for past data, making it perform well in backtests but fail in live trading.
Signs of overfitting:
Ways to prevent overfitting:
MT5 provides graphical data in the Results and Graph tabs, helping you visually assess an EA’s stability.
Equity Curve Type | Interpretation |
Smooth upward growth | Ideal performance, good consistency. |
Slow rise with occasional dips | Acceptable, but check drawdown. |
Steep spikes, deep crashes | Overfitted or high-risk EA. |
Flat or downward slope | Non-profitable, needs adjustments. |
To get the best possible EA settings, compare different optimisation tests. To compare different optimisation tests effectively, traders must:
After analysing the resu
Ultima Markets is a fully licensed broker and a multi-asset trading platform offering access to
250+ CFD financial instruments, including Forex, Commodities, Indices and Shares. We
guarantee tight spreads and fast execution. Until now, we have served clients from 172
countries and regions with our trustworthy services and well-built trading systems.
Ultima Markets has achieved remarkable recognition in 2024, winning prestigious awards
such as the Best Affiliates Brokerage, Best Fund Safety in Global Forex Awards, and
the Best APAC CFD broker in Traders Fair 2024 Hong Kong. As the first CFD broker to join
the United Nations Global Compact, Ultima Markets underscores its commitment to
sustainability and the mission to advance ethical financial services and contribute to a
sustainable future.
Ultima Markets is a member of The Financial Commission, an international independent
body responsible for resolving disputes in the Forex and CFD markets.
All clients of Ultima Markets are protected under insurance coverage provided by Willis
Towers Watson (WTW), a global insurance brokerage established in 1828, with claims
eligibility up to US$1,000,000 per account.
Open an account with Ultima Markets to start your index CFDs trading journey.