Skip to content
EN
Send my files

Guide · MetaTrader 5

How to get your data out of MT5

Your code never leaves your computer. You don’t send it to us, we don’t see it and we don’t run it. What we receive is a file full of numbers.

A note about the screenshots: they show MetaTrader with its interface in Spanish. The arrows point at the right place, and the text below gives you the English menu name with the Spanish one in brackets, so you can match them up.

If you already know MT5, here is the whole thing in four lines
  1. Level 1: right-click the Tester’s results tab → save the report.
  2. Level 2: the .opt files in Tester\cache, if you ever optimised.
  3. Level 3: copy Botospy.mqh into MQL5\Include, add #include <Botospy.mqh> at the top of your .mq5 and recompile.
  4. Run a slow complete optimisation, never the genetic one, with 2–3 parameters and between 30 and 150 combinations in total.
  5. When it finishes, send us MQL5\Files\botospy_matrix.csv.

And before anything else: if your bot writes a file while it trades, make a copy. During an optimisation it runs hundreds of times and overwrites it.

Before you start: make a backup

Stop and think for a moment about whether your bot writes any file while it trades: a trade log, a CSV, a report. If it does, make a copy before going any further.

The reason isn’t obvious: during an optimisation your bot doesn’t run once, it runs hundreds of times. If it always writes to the same place, each run overwrites the last, and you end up with the file from the final combination tried — which is not the configuration you actually use.

It happened to us with our own bot. We lost the reference file and had to regenerate it. That is why this is up here and not in a footnote.

Level 1 — The report you already have

If you only want to know what we can measure for you, this is enough to start. Nothing in the bot needs touching.

Open the Strategy Tester

Menu View → Strategy Tester (Ver → Probador de estrategias), or the shortcut Ctrl+R. A panel opens at the bottom: everything that follows lives there, including the later levels.

While you’re there, note Symbols (Símbolos) a few lines up in that same menu. You’ll need it at the end, for the price history.

The View menu with the Strategy Tester option highlighted

Send the report you already saved

If you have ever saved a backtest report, that file works for us: it carries the summary and the list of trades, which is all level 1 needs.

Don’t have it saved and can’t find how? Write to us and we’ll look at it together. The exact path changes between MT5 versions, and we would rather not put a set of clicks here that might not match your screen — if you end up wandering through menus that don’t exist, the guide is getting in your way instead of helping.

And if it’s easier, skip this level: the optimisation matrix from level 3 gives us considerably more, and that one is documented here step by step.

Level 2 — The file your MT5 already generated on its own

If you have ever optimised your bot, MT5 saved the result of every pass without you doing anything. That file is valuable to us and costs you no work at all: you just have to go and find it.

With it we work out how many times you really searched and correct your Sharpe ratio for that search. It is the difference between believing a good result and knowing how much of it is merit.

Go to the data folder

Menu File → Open Data Folder (Archivo → Abrir carpeta de datos). But this time, instead of going into MQL5, go into the Tester folder and then into cache.

MT5's File menu with the Open Data Folder option

Take the .opt files

Inside there are files with the .opt extension. Each one corresponds to an optimisation you launched at some point.

Send us the one matching the bot and the period you are auditing. If you don’t know which it is, send whatever is there and we’ll identify them: they carry the expert’s name inside.

None at all? Then you have never optimised that bot on this computer, and this level does not apply. Go straight to level 3, which gives more information anyway.

Level 3 — The optimisation matrix

This is what unlocks the overfitting test, the one that really separates a strategy from a well-chosen coincidence. About ten minutes of setup; after that it runs on its own.

Put our file where it belongs

We send you a file called Botospy.mqh. The MT5 folder is hidden somewhere odd in Windows, so don’t go looking for it by hand: MT5 opens it for you.

  1. Menu File → Open Data Folder (Archivo → Abrir carpeta de datos)
  2. Go into the MQL5 folder
  3. Inside, go into Include
  4. Paste Botospy.mqh there
1MT5's File menu with the Open Data Folder option
2The data folder open, with an arrow pointing at MQL5
3Inside MQL5: arrows pointing at the Files and Include folders

Add one line to your bot

Open MetaEditor (it comes with MT5: menu Tools, or the F4 key) and load your bot’s .mq5.

Right at the top you’ll see a block of lines starting with #include. Add ours at the end of that block:

#include <Botospy.mqh>

Save and compile. If it compiles without errors, you’re done.

The header of a .mq5 in MetaEditor, with the #include line added among the others

Set up the optimisation

In the Tester, the Settings tab (Configuración). Out of that whole screen you only have to touch four fields; leave the rest as it is.

  1. Your bot. Under Expert(Experto) pick your robot’s file, the same one you always work with.
  2. Your whole period. Under Date(Intervalo), the full dates you used while developing it — not a slice. If you shorten the period you are deciding which part of your own history gets audited, and that is exactly what we don’t want.
  3. Real ticks. Under Modelling(Modelado), the most detailed option. The fast modes invent how price moved inside each candle, and that invention always flatters the result: it skips stops that in reality would have been hit. It is the difference between a test and an illusion.
  4. Your real capital. Under Initial deposit(Depósito inicial), the money you actually intend to trade with. This is not a detail: maximum loss as a percentage is computed against that figure, so an invented deposit gives you back an invented risk.

The one thing you don’t get to choose freely: among the mode options you’ll see “Fast genetic based algorithm” next to “Slow complete algorithm”. The genetic one sounds better because it is far quicker. Don’t pick it. It is quick precisely because it skips combinations: it prunes paths it doesn’t like the look of. And we need to see them all, including the bad ones — those are exactly the ones that tell us whether your bot holds up. Choose the slow complete one, even though it takes longer.

That’s the test configured. The Start button is at the bottom right of the panel — but don’t press it yet: first you have to choose which parameters to try, which is the next step.

1The Tester's Settings tab: expert, symbol, dates and modelling
2The mode options: slow complete algorithm versus fast genetic based algorithm

Choose which parameters to try

The Inputs tab (Parámetros de entrada). To the left of each row there’s a checkbox; ticking it means “try several values of this one”, and switches on three columns: the lowest value, the increment, and the highest. The last column tells you how many values will come out.

Tick two or three parameters, no more. What matters is the total number of combinations: multiply the “steps” of everything you ticked.

Total combinationsAny good?
Fewer than 20Falls short
Between 30 and 150Perfect
More than 300Adds nothing and takes forever

Do the names look nothing like what we’ve described? That’s normal and there’s a fix. Keep reading just below.

The Inputs tab with two boxes ticked and the Start, Step, Stop and Steps columns

If the names don’t match, you’re not doing it wrong

These two images are the same screen, just scrolled with the mouse wheel. At the top the parameters show up as InpVerbose or InpTB_TP1_Mult. Below, as“Max VolExp simultáneos” or“% caída desde pico” — this bot’s author wrote the comments in Spanish, which is exactly the point.

The parameters shown with their technical English namesThe same list, further down, showing the names in Spanish

It is neither your mistake nor ours: when the bot’s author writes a comment next to a parameter, MT5 shows the comment and hides the real name. And since every bot writes it in its own language — plenty come in Russian or English — what you see on your screen may look like nothing at all.

That is why we will never tell you “tick InpEntryZ”: that text may not exist anywhere on your screen. We’ll tell you where it is.

The thirty-second trick

And if you do need the real names, there is a way to get them all at once:

  1. Click on the Variable column.
  2. Press Ctrl+C. Careful: there is no “Copy” in the right-click menu, it has to be the shortcut.
  3. Open Notepad and paste with Ctrl+V.
Notepad with every parameter pasted in, showing the real English names

Out come all the real names, and as a bonus the full range of each one:

name = value || start || step || stop || ticked?

So at a glance you also see which parameters are ticked for optimisation: they are the ones ending in Y. It is the quickest way to check you ticked what you meant to before launching an optimisation that runs for hours.

Launch it and watch the first ten minutes

Press Start. You don’t have to watch the whole thing, but stay for the first ten minutes.

The failure that shows up most is a disk space error, and always at the start: MT5 prepares the price data on every core at once and takes up a fair amount all at once. If you see it, stop, free up space and launch again. If ten minutes pass and it’s going fine, you can leave it alone.

The optimisation running, with the progress bar and the agents working

Send us the file

When it finishes, go back to File → Open Data Folder(Archivo → Abrir carpeta de datos), into MQL5, and this time into Files. There it will be:

botospy_matrix.csv

That’s the one we need. We take care of the rest.

The MQL5 → Files folder with botospy_matrix.csv inside

Separately: the price history of your instrument

This is not another level and it does not depend on the previous ones: it can be sent alongside any of them, and it is a file your MT5 already has.

With it we check something no other test can: whether the prices your bot claims to have entered at really existed at that moment. We take each trade and look at what actually traded that hour. If a price falls outside what the market recorded, that trade cannot have executed the way it is declared.

It is the one finding that admits no argument, because it is not our analysis against your platform: it is your report against the prices the market recorded.

Export the bars for your instrument

Menu View → Symbols (Ver → Símbolos, or Ctrl+U), find the instrument your bot trades and go to the Bars tab (Barras).

  1. Choose the same timeframe your bot uses (H1, M15…). Don’t grab M1 “just in case”: it’s millions of rows and adds nothing if your bot works on another scale.
  2. Set the same dates your backtest covers.
  3. Press Request (Solicitar). Until you press it the table looks empty — you haven’t done anything wrong.
  4. With the table loaded, use the export button to save it to a file.

Out comes a text file of several megabytes. That’s normal.

The Symbols dialog, Bars tab, with XAUUSD on H1 and 36,930 bars loaded

Check it’s from the same broker

Open it in Notepad to confirm it looks right: a header with <DATE>, <TIME>, <OPEN>, <HIGH>, <LOW> and <CLOSE>, and below it one row per hour.

Important: it has to be from the broker you ran the backtest with. Prices differ between brokers, and if they don’t match we detect it and tell you, rather than handing you a wrong result.

Same with the clock: if your history comes from another server on another time zone, we detect it and correct it ourselves. You don’t have to do anything.

The first rows of the exported file, with the DATE, TIME, OPEN, HIGH, LOW and CLOSE columns

What exactly you are sending

It’s normal to want to know before sending anything. The file carries one row per combination you tried: that combination’s month-by-month result and the numeric values of the parameters it used.

It does not carry your code, your entry logic, or anything that would let someone reconstruct how your bot decides. They are result numbers.

Send the fileOther platforms