MetaTrader 5 remembers every deal you make, but it keeps them inside the terminal. SetupBook can pull them into your journal by itself: a small Expert Advisor called SetupBookSync runs inside MT5 and sends each deal to SetupBook the moment it happens. You type nothing. The setup takes about ten minutes, and you do it once.

This guide shows every click, with pictures, on Windows and on Mac. If you use MetaTrader 4, follow the MetaTrader 4 guide instead; the steps are almost the same, but the file is different.

Before you start

  • A SetupBook account. It is free: sign up here.
  • MetaTrader 5 installed on your computer and logged in to your broker account. Demo or live, any broker. The web terminal and the phone app cannot run Expert Advisors; you need the desktop program.
  • Ten minutes.

SetupBookSync only reads. It cannot open, change or close an order, and it never sees your password. The only secret it holds is the token from step 1, and that token can only write into your own journal. The source code is public at /ea/SetupBookSync.mq5, so anyone can check what it does.

1. Create the connection and copy the token

In SetupBook open Settings → Connections and press Add connection. Choose MetaTrader 5, leave the account on Create from the platform account, and press Create and show the token.

SetupBook's Add a connection dialog with MetaTrader 5 selected and the Create and show the token button highlighted
Settings → Connections → Add connection. Pick MetaTrader 5 and press Create and show the token.

A dialog shows your sync token, a long code that starts with sbk_. Press Copy. The token is shown only this once; if you lose it, open the connection later and press New token. On the same dialog click Download SetupBookSync.mq5 and keep the file somewhere easy to find, for example on the desktop.

The sync token dialog in SetupBook with the Copy button and the Download SetupBookSync.mq5 link highlighted
Copy the token and download the file. Both come from this one dialog.

2. Put SetupBookSync.mq5 in the Experts folder and compile it

MetaTrader only sees programs that sit inside its own data folder. In MT5 open File → Open Data Folder, go into MQL5, then Experts, and drop SetupBookSync.mq5 there.

The MQL5 folder tree of MetaTrader 5 with SetupBookSync.mq5 inside the Experts folder and the compiled SetupBookSync.ex5 next to it
MetaTrader 5 → MQL5 → Experts. After compiling, an .ex5 file appears next to the .mq5.

On Windows, File → Open Data Folder opens the right place at once, usually a folder under C:\Users\<your name>\AppData\Roaming\MetaQuotes\Terminal. On a Mac the window is a Windows-style one that starts at Desktop: click My Computer → (C:) → Program Files → MetaTrader 5 → MQL5 → Experts. In Finder that folder is usually at ~/Library/Application Support/net.metaquotes.wine.metatrader5/drive_c/Program Files/MetaTrader 5/MQL5/Experts.

The file is source code, so MetaTrader has to compile it once. Open MetaEditor (press F4 in MT5, or Tools → MetaQuotes Language Editor). In its Navigator open Experts, double-click SetupBookSync.mq5, then press F7 or the Compile button. The panel at the bottom ends with 0 errors, 0 warnings. Close MetaEditor. The Mac version of MT5 includes MetaEditor too.

MetaEditor with SetupBookSync.mq5 open, the Compile button highlighted and the result 0 errors, 0 warnings in the bottom panel
MetaEditor: open the file, press F7, read 0 errors at the bottom.

Back in MT5 open the Navigator panel (View → Navigator, or Ctrl+N), right-click Expert Advisors and choose Refresh. SetupBookSync appears in the list. If it does not, close MetaTrader and open it again.

3. Allow setupbook.io in Options

MetaTrader blocks every internet request from a program unless you allow the address first. Open Tools → Options, go to the Expert Advisors tab, tick Allow WebRequest for listed URL, double-click the empty line below it, type https://setupbook.io and press OK.

MetaTrader Options dialog, Expert Advisors tab, with Allow WebRequest for listed URL ticked and https://setupbook.io in the list
Tools → Options → Expert Advisors. Tick the box, add the address, press OK.

Type the address exactly as shown: https://setupbook.io, no www, nothing after .io. This is the step people skip most often; without it the chart says cannot reach.

4. Turn on Algo Trading and put the Expert Advisor on a chart

Look at the toolbar: the Algo Trading button must be green. If it is not, click it once. Without it MetaTrader runs no Expert Advisor at all, ours included.

Now drag SetupBookSync from the Navigator onto any open chart. The symbol and the timeframe do not matter. A window opens: go to the Inputs tab, double-click the value next to SetupBook sync token, paste the token and press OK.

The SetupBookSync properties window in MetaTrader, Inputs tab, with the SetupBook sync token row highlighted
Inputs tab. Only the first row matters: paste the token there.
A MetaTrader 5 chart with Algo Trading on, the SetupBookSync status text in the top-left corner and the Expert Advisor's name in the top-right corner
Green Algo Trading button, status text in the corner, the name at the top right: it is running.

The top-left corner of the chart shows what SetupBookSync is doing. The top-right corner shows its name; in MT5 a small icon next to it tells you whether it is allowed to run. If it says it is not, Algo Trading is off or Allow Algo Trading was unticked in the Common tab.

5. Check that the deals arrived

Within a few seconds the status in the chart corner changes to the number of deals sent. The first run sends your whole history in pages of three hundred deals, so a few hundred deals take a few seconds. In SetupBook open Settings → Connections: the card now shows your broker and login, a Demo badge when it is a demo account, and the time of the last sync. A SetupBook account named after the broker and login was created for you, and your trades are under Trades.

A SetupBook connection card for an MT5 account showing the Demo and Active badges, the last sync time and the number of trades
The connection card after the first sync: broker and login, Demo, Active, last sync, trade count.

If the history was empty, for example on a brand new demo, open and close one small trade. It shows up in SetupBook within seconds.

What happens after the setup

  • A new deal arrives within about five seconds, as long as MetaTrader is open. A trade with several partial exits is one trade in the journal, with every fill listed.
  • The stop and target of your open positions are refreshed once a minute, so a moved stop shows as moved in the journal.
  • While MetaTrader is closed nothing is sent. The next time you open it, SetupBookSync sends what you missed.
  • The fields that came from MetaTrader (symbol, side, prices, size, commission, swap, net result) are locked in the journal and stay exact. Everything you add (plan, setup quality, mistakes, notes, screenshots) stays yours.
  • Demo or live is read from the terminal. A prop firm account arrives as live; change the account type to prop in SetupBook if you want the daily limit and the challenge tracking.
  • You can stop the sync at any time: remove SetupBookSync from the chart, or press New token or delete the connection in SetupBook. The trades already in the journal stay and become editable.

If something does not work

What you see Why What to do
cannot reach … error 4014 or 5203 in the chart corner The address is not in the allowed list Step 3: add https://setupbook.io exactly, press OK, then remove SetupBookSync from the chart and drag it on again
token rejected The token was mistyped or a new one was made Press New token in SetupBook and paste the new one into the Inputs tab
SetupBookSync is not in the Navigator The file was not compiled, or sits in the wrong folder Step 2: the file must be in MQL5/Experts and compiled with F7; then right-click Expert Advisors → Refresh
The name in the corner says it is not allowed to run Algo Trading is off, or Allow Algo Trading is unticked in the Common tab Turn Algo Trading on; drag the Expert Advisor onto the chart again and tick the box (it still never trades)
Every time is one hour off The broker's clock follows a different daylight-saving rule In SetupBook edit the connection and change Broker clock to European DST or UTC
WebRequest is not available in the Strategy Tester The Expert Advisor runs only on a live chart Put it on a normal chart, not in the tester

Frequently asked questions

Is it safe? Can SetupBookSync trade on my account?

No. It only reads the deal history and the open positions. It has no code that places, changes or closes orders, and it never sees your password. The only secret it holds is the token, which can only write into your own SetupBook journal. The source code is public, so anyone can check.

Does it work with every broker?

Yes. Any MetaTrader 5 terminal can run it, on a demo or a live account, with forex, metals, indices, crypto CFDs or futures.

Does it work on Mac?

Yes, with the Mac version of MetaTrader 5 from MetaQuotes or from your broker. MetaEditor is included, so you can compile the file on the Mac. The only difference is where the Experts folder is, shown in step 2.

Why do I have to compile the file?

MetaTrader runs compiled programs only, and we publish the source so that you can read exactly what leaves your terminal. Pressing F7 once turns it into the program. The MetaTrader 4 file is published already compiled.

Can I connect more than one MT5 account?

Yes. Create one connection per account in SetupBook, each with its own token, and put SetupBookSync on a chart in each terminal. Every account gets its own SetupBook account.

What happens when my computer is off?

Nothing is sent while MetaTrader is closed. When you open it again the sync catches up from where it stopped. If you want deals to arrive while your computer is off, run MetaTrader on a VPS.

What do the other inputs of the Expert Advisor do?

Leave them as they are. Sync endpoint is SetupBook's address. Check every (seconds) is how often the open positions are refreshed, sixty by default. Deals per request is the page size of the first full sync. Log every request prints each request and answer to the Experts tab, useful only when something fails. The full source is published at /ea/SetupBookSync.mq5, so you can read exactly what leaves your terminal.

Does it cost anything?

No. The sync and the journal are free.

Prefer typing trades by hand or importing a report file? Both still work: see the user guide and the import guide. For how the other platforms connect, read the overview of every connection.