Skip to content
← All posts

Gold EAs

How to Backtest an EA in MT4: Strategy Tester Settings and Tick Data

EABuild Team · · 11 min read

How to Backtest an EA in MT4: Strategy Tester Settings and Tick Data – EABuild

To backtest an EA in MT4, you run the expert advisor (an automated trading program that runs inside MetaTrader) through the Strategy Tester, which replays stored price history and records the trades the EA would have made. This guide covers what to prepare, the tester settings one by one, how the three modelling modes treat price data, how to read the report, and why the result describes the past and nothing more.

What to prepare before you open the tester

MetaTrader 4 is older than MetaTrader 5, and its tester is simpler. That makes the preparation more important, because the tester will happily run a badly set up test and show you a clean-looking report.

A compiled EA in the right folder

The EA must be a compiled .ex4 file inside the Experts folder of your MT4 data folder. If you have just downloaded it, follow the guide on how to install an EA in MT4, then restart the terminal so the EA appears in the Navigator and in the tester's Expert list.

The symbol, timeframe and set file

Test the symbol and timeframe the listing names. An EA designed for XAUUSD on M15 tells you little when you run it on EURUSD on M1, because its logic was not built for that market. Check that your broker's symbol name matches, since some brokers add a suffix such as a dot or a letter.

Many EAs come with set files (saved lists of input settings you load in MetaTrader). Pick one set file for the first run and write down its name, so you can always say which inputs produced which result.

A question the test should answer

Decide what you want to learn before you press Start. Practical questions work well: does the EA open and close trades as its description says, how deep does the drawdown (the drop from the account's peak) get, and does it still behave when spreads widen? A vague wish to see whether it makes money pushes you towards adjusting inputs until the curve looks pleasant, which is the over-fitting trap described later.

Step by step: running a backtest in MT4

The steps follow the Settings tab of the Strategy Tester from top to bottom. Wording can differ slightly between MT4 builds, so treat the list as a map.

  1. Open the tester. In MetaTrader 4 choose View, then Strategy Tester, or press Ctrl+R. The panel opens at the bottom of the terminal.
  2. Choose the EA. On the Settings tab, keep the first dropdown on Expert Advisor and select your EA from the list.
  3. Set the symbol and period. Select the symbol the EA is listed for and the timeframe in the Period box, for example XAUUSD and M15.
  4. Choose the model. This is the setting that matters most. The next section explains Every tick, Control points and Open prices only.
  5. Set the spread. Pick a fixed spread in points, or use the current one. A scalper is very sensitive to this value, so test a realistic figure for your broker, not the narrowest spread you have ever seen.
  6. Tick Use date. Enter a From and To date. A range that includes both quiet and volatile weeks tells you more than one calm month.
  7. Open Expert properties. On the Testing tab, enter the initial deposit, the account currency and whether long, short or both positions are allowed. Use the deposit you would really trade, and if the listing gives a recommended minimum deposit, start there rather than with a large balance that hides drawdown.
  8. Load the inputs. On the Inputs tab of the same window, click Load and choose the set file you noted earlier. Check a few key values on screen, then press OK.
  9. Leave optimisation off. Optimization (running many input combinations automatically) should stay unticked for a first run. You want one clean test of one set of inputs.
  10. Start the test. Press Start. Tick Visual mode first if you want to watch trades appear on a chart; it runs slower, but it is the quickest way to confirm the EA does what you expect.
  11. Read the results. When the run ends, open the Results, Graph and Report tabs and the Journal. Later sections explain what to look at.

Every tick, Control points and Open prices only

MetaTrader 4 does not hold a real tick history from the broker. It stores one-minute bars, and the tester builds the price movement inside each bar from them. The model you choose decides how much of that building is done.

  • Every tick. The tester generates a series of simulated ticks for every bar, using the lower timeframe data available. It is the slowest model and the closest to live conditions the stock tester can offer.
  • Control points. The tester uses only a few price points per bar, so it is faster. It can miss price moves inside a bar, which matters for anything that reacts quickly.
  • Open prices only. The tester acts only when a new bar opens. It suits EAs that explicitly work on bar opens and is a poor fit for any strategy that watches price during a bar.

As a rule, an EA that trades inside a bar, such as a scalper, a grid or a news strategy, needs Every tick to give a believable picture. A quick model is useful only to check that your settings load and that the EA places orders at all. Run the final test in Every tick.

Tick data and history limits

The phrase tick data causes confusion, so it helps to be exact. In MT4 the ticks in an Every tick test are generated, not recorded. Some traders import tick data from outside sources to replace the generated ticks. That can change the result, and the quality of such files varies, so treat any outside tick file as an extra assumption you must be able to explain.

The history you test on also has limits. Open the History Center with F2 to see which bars your terminal holds for the symbol and timeframe, and download more if the range you want is missing. In Tools, then Options, on the Charts tab, the limits for maximum bars in history and in chart restrict how far back the tester can read, so raise them if a long test stops early. Restart the terminal after changing them.

Modelling quality and gaps

After a test, the Report tab shows a modelling quality figure. It describes how much of the period was backed by real minute data rather than gaps and estimates. A low figure means the result rests on guesses, so download more history and run the test again before you draw any conclusion.

Spread, slippage and trading costs

A backtest is only as honest as its costs. The tester fills orders cleanly, while a live account meets slippage (the difference between the price you asked for and the price you got), requotes and occasional rejections.

Spread is the first place to be careful. A fixed spread that is lower than your broker's typical spread makes a fast strategy look cheaper than it will be. Try a second run with a wider spread and see how much of the result survives. Commission and swap (the overnight financing charge) also belong in your thinking, so check the contract details of the symbol with your broker.

The stock MT4 tester has no setting for execution delay, so a test cannot show how much a slow connection costs a fast EA. Keep that in mind and compare the tester with a demo account run.

Backtesting gold and scalping EAs

Gold moves quickly and spreads change during the day, so the choice of model and spread matters even more on XAUUSD. The shop lists several MT4 EAs you can use to practise this process, each described by its listing.

Gold Scalping EA for MT4 is a scalping and breakout expert advisor listed for XAUUSD on M5 and M15. The download includes two compiled files and one set file, so you have a single starting configuration to test and note down.

Advanced Gold Trading EA for MT4 combines scalping and news trading on XAUUSD, M15, and needs MT4 build 1471 or newer. It comes with four set files. Run each set file on the same dates, model and spread, and keep a short table of file, range and drawdown so the runs stay comparable. News trading means trading around economic releases, when spreads can widen and slippage is common, so test a wider spread as well.

Scalping EA Robot for MT4 is listed for the M1 timeframe on XAUUSD, EURUSD, GBPUSD and USDJPY, and uses scalping, martingale and news trading. Martingale means increasing the lot size after a losing trade, so drawdown can rise quickly. The listing gives a recommended minimum deposit of $1,000, which is a sensible starting point for the tester's initial deposit. Read the largest losing streak in the report rather than the final balance.

For background on how gold EAs make decisions and which strategy types you will meet, the gold EA guide is a useful companion to this post.

Reading the report

The Report tab lists the numbers and the Graph tab draws the balance curve. The balance moves when trades close, and trades that are still open do not show up on it, so open losses can hide behind a smooth line. Watch the drawdown figures closely for that reason.

Figures worth checking first

  • Maximal drawdown. Ask whether you could sit through that drop with your own account and your own nerves.
  • Total trades. A handful of trades says very little. A longer run gives you more to judge.
  • Profit factor and expected payoff. They summarise gross profit against gross loss and the average result per trade. They describe one historical run and are not a promise.
  • Largest loss and consecutive losses. These show how bad a bad streak became. For grid and martingale EAs they are especially revealing.
  • Modelling quality. As above, a low figure means the result is built on gaps.

The Journal and the trade list

Do not stop at the summary. The Journal records errors such as missing history, invalid stops or rejected orders. Then scan the list of trades on the Results tab. If trades cluster in odd places or the EA goes quiet for weeks, the cause is usually a setting, a symbol mismatch or a data gap, and the Journal often says which.

Why a backtest is not a forecast

A backtest answers one narrow question: how would these rules have behaved on this data, with these assumptions? It cannot say what the market will do next. Four limits apply to every test.

  • The past does not repeat on schedule. A market phase that suited the EA once may not return.
  • Over-fitting. If you keep changing inputs until the curve looks good, you have fitted the EA to old data. The result then reflects your tuning more than the strategy.
  • Data differences. Your broker's history, spreads and execution differ from another broker's and from live conditions.
  • Cost simplification. The tester ignores most of the friction that a live account meets.

To reduce these problems, test more than one period, including an awkward one. Keep a stretch of history you never tuned on and test it once at the end. Then run the EA on a demo account and compare what happens there with the tester, since a demo uses live prices, although its execution can still differ from a live account.

Common problems and quick checks

  • No trades at all. Check the symbol name, the timeframe, the lot size against the symbol's minimum and whether the EA needs an input switched on. Read the Journal.
  • The EA is missing from the list. It is probably not in the Experts folder, or it is not compiled. Refresh the Navigator or restart the terminal.
  • The test stops early or starts late. The history or the chart bar limits are too short. Download more bars in the History Center and raise the limits in Options.
  • Results change between runs. Confirm the date range, model, spread, deposit and inputs are identical, and that no new history was downloaded in between.
  • The test is very slow. Every tick over a long period takes time. Shorten the range for trial runs and keep the full range for the final test.

Next steps

Once you have a clean test, move to a demo account and watch the EA there before you consider live trading. Every product in the shop is a digital download, and all of them are included in the membership, so you can test several EAs on the same dates and settings.

Trading foreign exchange and CFDs carries a high level of risk and may not be suitable for all investors. Past performance does not guarantee future results; only trade with money you can afford to lose.

Tags: Strategy Testing, Expert Advisors, Gold EAs

← All posts

Get every EA with membership

313 products · from $16.59/month

See plans

More in Gold EAs