The Strategy Tester runs expert advisors (EAs), the automated strategies written in MQL5. It does not replay the chart for manual trading. If your strategy is discretionary, see how to backtest a strategy by hand.
Open the tester
In MetaTrader 5, open View → Strategy Tester or press Ctrl+R. The panel opens at the bottom of the terminal. On the Overview tab choose Single test to run one EA once.
Settings that decide the result
On the Settings tab:
- Expert. The EA to test. It must be in the Experts folder of the terminal.
- Symbol and timeframe. Test on the symbol of the broker you will trade with. Contract sizes and spreads differ between brokers.
- Date. Pick a period with different market conditions, not only the last strong trend.
- Forward. Splits the period. The EA is tested on the first part and checked on the rest it has not seen. 1/3 or 1/4 is a common choice.
- Delays. Simulates execution delay. Zero delay flatters scalping strategies, so add a realistic value.
- Modeling. How the tester builds price movement inside each bar. See the next section.
- Deposit and leverage. Use the account size and leverage you will trade with.
The EA's own parameters are on the Inputs tab.
Modeling modes
| Mode | What it uses | When to use it |
|---|---|---|
| Every tick based on real ticks | Ticks recorded by the broker | Final checks, scalping, tight stops |
| Every tick | Ticks generated from minute bars | Most tests, faster than real ticks |
| 1 minute OHLC | Four prices of each minute bar | Quick checks of strategies with wide stops |
| Open prices only | The open of each bar | EAs that act only on a new bar |
| Math calculations | No price data | Pure calculations, not trading |
The faster the mode, the less it knows about what happened inside a bar. If the stop and target can both be hit within one bar, only tick modes tell you which came first. Run the final test on real ticks when the broker provides them.
Optimization
Optimization runs the EA many times with different input values. On the Inputs tab, tick the parameters to vary and set start, step and stop. On the Settings tab choose the algorithm: slow complete tries every combination, fast genetic searches a large space in less time.
Optimization is where most backtests start to lie. With enough parameters, some combination always fits the past. Three habits help:
- Vary as few parameters as possible.
- Prefer a broad area of good results over one sharp peak.
- Check the chosen values on the forward period. If results collapse there, the fit was to noise.
Read the report
After a run, open the Backtest tab. The numbers to read:
- Total net profit. The result after the simulated costs.
- Profit factor. Gross profit divided by gross loss. Below 1 means the EA lost money.
- Expected payoff. Average result per trade. Positive is the minimum.
- Equity drawdown maximal. The deepest fall from a peak, including open trades. This decides whether a prop firm account would have survived.
- Total trades. Fewer than 100 makes every other number weak.
- Recovery factor. Net profit divided by maximum drawdown.
The Graph tab shows balance and equity, and the Trades tab lists every deal. A smooth balance line with a jagged equity line means the EA holds losing trades for a long time.
Visual mode
Tick Visual mode to watch the EA trade on the chart in a separate window. Use it to check that entries match what you intended, not to measure performance.
From the tester to live trading
A good report is a reason to forward-test, not to go live with full size. Run the EA on a demo account or with minimal size for a few weeks and compare its expectancy with the test. Keep a trading plan for the EA too: maximum drawdown before you switch it off, and how often you review it.
Tradeart connects to MetaTrader 5 and imports the EA's live trades automatically, including trades opened by an expert advisor. Read more about the MT5 trading journal and how drawdown is measured.
