September 18, 2026·7 min read

How to Connect MetaTrader 5 and Sync Your Trades Automatically

GuideMetaTraderImport

MetaTrader 5 keeps a full record of every trade you take — but getting that record into a journal usually means exporting reports and retyping fills by hand. SniperJournal skips all of that. Its MetaTrader agent reads your closed-trade history straight from the terminal and files it in your journal for you.

This guide sets it up in three steps: create a connection, install the agent in MT5, and start it. We'll use the auto-sync agent — a small Expert Advisor that sends each trade the moment you close it — and it's read-only from start to finish: it never sees your password and never places a single order. Prefer to watch? There's a full video walkthrough at the end.

What the agent does (and what it never touches)

The agent does one job: it reads the closed trades already sitting in your MT5 terminal and sends them to the SniperJournal portfolio you connect. The auto-sync version keeps going after that — every time you close a position, it forwards that one trade automatically.

Just as important is what it never does. It's read-only: it never places or modifies an order, and it never sees your broker password. It sends your login number, server, broker name, account currency and the raw buy/sell deals — never your password, your name or your balance.

Because it reads your terminal's local history rather than the broker's API, it works with essentially any MetaTrader 5 desktop terminal — including brokers that offer no API at all. We've run it live on MetaQuotes and IC Markets accounts, among others.

What you'll need

  • The desktop MetaTrader 5 terminal — Windows, or macOS/Linux through Wine. The web and mobile terminals can't run scripts or Expert Advisors.
  • A SniperJournal account (free) with a portfolio in the same currency as your MT5 account — USD, EUR, GBP, JPY, AUD, CAD, CHF or NZD (Exness cent accounts are USC). Portfolios start in USD, so if yours is different, create one in the right currency before you connect.
  • About five minutes.

On a Mac, MetaTrader runs inside a Wine wrapper (the broker's Mac app is just MT5 packaged with Wine, or you use Parallels/CrossOver). The same ZIP works — the agent files are terminal bytecode, not macOS apps. The only quirk: "Open Data Folder" may open a Wine file explorer instead of Finder. Everything else is identical.

Step 1 · Create your connection in SniperJournal

In SniperJournal, open Settings → MetaTrader and click New connection. Pick the portfolio your trades should land in — remember, its currency has to match your MT5 account — give it an optional label, and click Connect.

Pick the portfolio your MT5 trades will land in, then click Connect.

SniperJournal shows you a connection token once. Copy it now and keep it somewhere safe — it's shown a single time, though you can rotate it later if you lose it. The panel also shows the ingest URL (already built into the agent) and the URL you'll allow in Step 2. That token is the only thing that ties your terminal to your journal.

The token appears once — copy it before closing the panel. You can rotate it anytime.

Step 2 · Install the agent in MetaTrader 5

Download the agent ZIP (the Download agent button on that same screen) and unzip it. Inside you'll find two folders, MT5 and MT4 — open MT5. It holds a handful of files, but the only one you need is SniperJournalAgent.ex5, the auto-sync agent. The rest are the one-time Backfill script and the source files (.mq5, .mqh), which you can ignore.

Inside the MT5 folder, SniperJournalAgent.ex5 is the file you install — the rest are the Backfill script and the sources.

Now put that one file in the right place. The whole install is really just this: get SniperJournalAgent.ex5 into your terminal's Experts folder. Step by step, in MetaTrader 5:

  1. Open File → Open Data Folder. This opens the terminal's own data folder in your file explorer — not the app, the folder on disk.
  2. In that window, open MQL5, then Experts. You'll see the terminal's built-in folders there (Advisors, Examples, Free Robots) — that's the right place.
  3. Copy SniperJournalAgent.ex5 into this Experts folder. Just that one file, directly in Experts — no subfolder, nothing to compile.
SniperJournalAgent.ex5 sitting in MQL5 → Experts, right next to the terminal's own folders — exactly where it belongs.

Now tell MetaTrader to pick it up. In the Navigator panel on the left (press Ctrl+N if it's hidden), right-click Expert Advisors and choose Refresh — or just restart the terminal. SniperJournalAgent then appears in the list under Expert Advisors, ready to use.

After a Refresh, SniperJournalAgent appears under Expert Advisors in the Navigator — that's how you know it's installed.

One more thing before the agent can reach SniperJournal: you have to allow its URL. Open the options window with Tools → Options (or the shortcut Ctrl+O), and go to the Expert Advisors tab. Then:

  1. Tick "Allow WebRequest for listed URL".
  2. Double-click the empty "add new URL…" line and type exactly https://api.sniperjournal.io, then press Enter so it lands in the list.
  3. Click OK.
Tools → Options → Expert Advisors: WebRequest ticked and https://api.sniperjournal.io added to the list.

("Allow algorithmic trading" can stay off — the agent never trades, it only reads and sends.)

Step 3 · Start the agent and confirm it's syncing

Now attach the agent to a chart. In the Navigator, under Expert Advisors, drag SniperJournalAgent onto any chart of the account you want to sync — any symbol, any timeframe, it doesn't matter which.

The moment you drop it, a settings window pops up. Open the Inputs tab and paste your token — the one from Step 1 — into Connection token (from SniperJournal). Everything else is already filled in for you: the Ingest URL, "Send the full history once", and a few options you can leave as they are. Then click OK to finish (you don't need "Allow Algo Trading" — the agent never trades).

Paste your token into Connection token. The ingest URL is already filled in.

On start, the agent sends your full history once (that's the "Send the full history once" input — safe to leave on, nothing is duplicated). After that, every position you close is forwarded on its own: the Experts tab prints "position <id> -> imported 1" each time.

You'll know it's working from two places. First, on the chart itself: the agent draws a small status panel along the top. When all is well it reads something like "SniperJournal … | Backend OK | queue 0 | last: backfill OK"Backend OK means it reached SniperJournal, queue 0 means nothing is stuck waiting, and backfill OK means your history has already been sent.

The panel reads "Backend OK … backfill OK" — the agent connected and sent your history.

And second, back in SniperJournal: the connection card flips to Active, with the time of the last heartbeat and how many trades it imported. Your MT5 history is now in the portfolio you connected.

In SniperJournal the card shows Active, the last sync time, and how many trades came in.

Keeping the sync alive

Leave the terminal open and the agent does the rest. If the server is unreachable the moment you close a trade, the agent stores it in a local queue (the MQL5 → Files → SniperJournal folder) and retries by itself — even after you restart the terminal. Nothing is lost to a brief disconnect.

The agent sends a heartbeat every few minutes, which is what keeps the card on Active. Close the terminal for a while and the card goes stale — that's just "haven't heard from it lately," not lost data; it catches up when you reopen.

One note for hedging accounts: to close part of a position, use Toolbox → Trade → right-click → Modify or Delete → "Close Position" → Volume. The SELL/BUY buttons on the chart open brand-new positions instead.

Just want a one-time import?

If you'd rather not leave MetaTrader running, the ZIP also includes a one-shot script, SniperJournalBackfill.ex5. Copy it into MQL5 → Scripts, drag it onto a chart, paste the same token, and it sends your history in a single pass. It's safe to re-run — trades already in the journal are skipped.

For MT5, though, the auto-sync agent is the better default: it does that same one-time backfill on its first run and then keeps your journal current without you thinking about it.

If something fails

Almost everything shows up in the Experts tab. The most common cases:

  • "URL not allowed" / error 4014 — the WebRequest URL isn't set (the agent's panel says "Backend URL NOT ALLOWED"). Add it exactly as in Step 2, save with OK, then re-attach the agent to the chart.
  • HTTP 401 — the token is invalid or was rotated. Copy the current token from SniperJournal.
  • HTTP 409 — the token belongs to another MT5 account, the account is already linked to another portfolio, or the account currency doesn't match the portfolio (Exness cent accounts are USC).
  • HTTP 422 — the request was rejected; download the latest ZIP from SniperJournal.
  • "Could not reach the server (code 1001)" — the terminal couldn't reach the host. Check the URL, the Allow WebRequest list, and your internet.
  • "position <id> will retry (code -1)" — the server didn't answer that moment; the agent keeps it queued and retries on its own. Nothing to do.

The full error table lives in the in-app guide, under Settings → MetaTrader.

Watch the full setup

That's it. Once the agent is running, your MetaTrader 5 trades log themselves — no CSV exports, no manual entry — and SniperJournal turns that history into your calendar, tags, win rate and the rest. Trading on MetaTrader 4 too? It works a little differently, and we cover it in its own guide.

FAQ

Does the SniperJournal MetaTrader 5 agent place trades or need my password?

No. It's read-only: it reads your closed-trade history and sends it to your journal. It never places or changes an order, never sees your broker password, and never sends your balance or your name.

Does it work with my broker?

Almost certainly. The agent reads your terminal's local trade history rather than the broker's API, so any desktop MetaTrader 5 works — even brokers that don't offer an API. It's been run live on MetaQuotes, IC Markets and others.

Can I run it on a Mac?

Yes. MetaTrader on Mac runs inside a Wine wrapper, and the same ZIP works because the agent files are terminal bytecode, not macOS apps. The only difference: "Open Data Folder" may open a Wine file explorer instead of Finder. Every other step is the same.

Do I have to keep MetaTrader open?

For live auto-sync, yes — the Expert Advisor sends each trade as you close it, so the terminal needs to be running. If a close happens while the server is unreachable, it's queued and retried automatically. If you only want a one-time snapshot, run the Backfill script instead.

Where do my trades end up?

In the SniperJournal portfolio you chose when you created the connection. The account currency must match that portfolio's currency (Exness cent accounts are USC), which is what a few HTTP 409 errors are about.

SniperJournal

Free trading journal — dashboards, imports, and AI-assisted insights.

Ready to try it?

Free to use. No credit card required.