September 19, 2026·5 min read

How to Connect MetaTrader 4 and Import Your Trades

GuideMetaTraderImport

MetaTrader 4 is still everywhere in forex, and getting its trade history into a journal usually means exporting statements and cleaning them up by hand. SniperJournal skips that: a small script reads your closed trades straight from the terminal and files them in your journal.

One thing up front — MT4 works differently from MT5. There's no always-on agent here; instead you run a one-time import script whenever you want to update your journal. This guide covers the whole thing: create a connection, install the script, show your full history, and run it. It's read-only from start to finish — no broker password, no orders placed. Prefer to watch? There's a full video walkthrough at the end.

What the agent does (and what it never touches)

The script does one job: it reads the closed trades in your MT4 terminal and sends them to the SniperJournal portfolio you connect. Run it again later and it picks up anything new.

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 orders — 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 4 desktop terminal, including brokers with no API. We've run it live on Exness MT4.

The one big difference from MetaTrader 5: MT4 is manual. You run the script yourself each time — there's no auto-sync agent forwarding trades as you close them. If you want that hands-off, continuous sync, that's MetaTrader 5, and we cover it in its own guide.

What you'll need

  • The desktop MetaTrader 4 terminal, on your computer or on a Windows VPS — Windows, or macOS/Linux through Wine. The web and mobile terminals can't run scripts.
  • A SniperJournal account (free) with a portfolio in the same currency as your MT4 account (Exness cent accounts are USC).
  • The market open, ideally. MT4 only learns the server's time from live quotes, so running while the market is open lets the script detect it automatically. With the market closed, you'll set the GMT offset by hand (more on that in Step 3).

On a Mac, MetaTrader runs inside a Wine wrapper and the same file works. Two differences: "Open Data Folder" opens a Wine file window instead of Finder — in it, drive Z: is your Mac, so copy the file from Z: → Downloads and paste it into MQL4 → Scripts — and in the script's Inputs dialog you paste the token with right-click → Paste, because Cmd+V doesn't work there. Every other step is identical.

Step 1 · Create your connection in SniperJournal

In SniperJournal, open Settings → Connections, click Connect account and pick MetaTrader 4 from the list (you can also get there from the + button in the header). Choose the portfolio your trades should land in — its currency has to match your MT4 account — add an optional label, and click Create connection. MT4 and MT5 share the same kind of connection: a token works for either, and binds to the first terminal that uses it.

Pick the portfolio your MT4 trades will land in, then click Create connection.

SniperJournal shows you a connection token once, right there in the same panel. Copy it and keep it handy — you'll paste it into MT4 in Step 3 and, unlike MT5, you'll paste it again every time you re-run the script. Below it you'll find the URL you'll allow in your terminal and the Download SniperJournalBackfill.ex4 button; on the right, the setup video and the install steps — everything for Steps 2 and 3 in one place.

The token appears once — copy it before closing the panel. In MT4 you'll re-paste it on every run. The download button sits right below it, with the video and the install steps on the right.

Step 2 · Install the script in MetaTrader 4

Download the script with the Download SniperJournalBackfill.ex4 button under your token. It's a single file, SniperJournalBackfill.ex4 — nothing to unzip and nothing else to copy.

Now put it in place. In MT4:

  1. Open File → Open Data Folder, then go to MQL4 → Scripts.
  2. Copy SniperJournalBackfill.ex4 into that Scripts folder — just that one file, directly in Scripts (no subfolder); it's already compiled, nothing to build.
SniperJournalBackfill.ex4 copied into MQL4 → Scripts — just that one file.

Then tell MetaTrader to pick it up: in the Navigator panel (Ctrl+N if it's hidden), right-click Scripts and choose Refresh — or restart MT4. SniperJournalBackfill now appears under Scripts, ready to run.

After a Refresh, SniperJournalBackfill appears under Scripts in the Navigator — that's how you know it's installed.

Now allow the URL so the script can reach SniperJournal. Open Tools → Options → Expert Advisors (Ctrl+O), tick "Allow WebRequest for listed URL", add exactly https://api.sniperjournal.io, and click OK.

Tools → Options → Expert Advisors: WebRequest ticked and https://api.sniperjournal.io added.

Step 3 · Show all history and run the script

One MT4 quirk to know: the script only sees what the Account History tab is showing. So first, open that tab (in the Terminal panel — Ctrl+T if it's hidden), right-click it, and choose "All History". A shortened view means missing trades.

Right-click the Account History tab → "All History" so the script sees everything.

Now run it. Drag SniperJournalBackfill from the Navigator (Scripts) onto any chart. In the Inputs tab, paste your token into Connection token. If the market is open, leave the GMT settings as they are — the script reads the server time from live quotes. If it's closed, untick "Detect the server GMT offset from live quotes" and set "Server GMT offset in hours" to your broker's offset (most forex brokers use 2 or 3). Click OK.

Paste your token; leave GMT auto-detect on with the market open, or set the offset by hand.

In the connection panel, Waiting for your MetaTrader… switches on its own to Connected as soon as the trades arrive. In MetaTrader, open Toolbox → Experts and you'll see a line like "Done: imported N, already in journal M…". Your trades are now in the portfolio you connected, and back in SniperJournal, under Settings → Connections, the MetaTrader card flips to connected — with the time of that import and how many trades came in. Notice it says "connected", not "Active": the card is a snapshot of your last manual run, not a live feed. To keep your journal up to date you re-run the script whenever you want (Step 3 again, token and all) — which is the one thing MetaTrader 5's agent does for you automatically.

In Settings → Connections the MetaTrader card shows connected, the last import time, and how many trades came in.

Running it again later

This is the part that trips people up coming from MT5: MT4 doesn't remember the token between runs. Every time you want to refresh your journal, drag the script onto a chart again and paste your token again. It's safe to re-run as often as you like — trades already in the journal are skipped, so you only ever add what's new.

A Windows VPS works for MT4 too, if you'd rather not keep your own computer on — but it doesn't change the routine: you still re-run the script there whenever you want the journal updated. Continuous, hands-off sync remains an MT5 thing.

If re-pasting the token each time sounds tedious, that's exactly what the MetaTrader 5 auto-sync agent removes — it remembers the token and forwards every trade on its own. If your broker offers MT5, it's worth the switch.

If something fails

Everything shows up in the Experts tab. The usual cases:

  • "URL not allowed" / error 4060 (or 4014) — the WebRequest URL isn't set. Add it exactly as in Step 2, then run again.
  • "No live quotes: the market seems closed" — run again with the market open, or set the GMT offset by hand (Step 3).
  • "No closed trade orders in the Account History tab" — switch that tab to All History (Step 3).
  • HTTP 401 — the token is invalid or was rotated. Copy the current one from SniperJournal.
  • HTTP 409 — the token belongs to another account or to an MT5 connection, the account is already linked to another portfolio, or the currency doesn't match (cent accounts are USC). For the currency case, the connection card in Settings → Connections names both currencies and the fix: create a portfolio in your account's currency, connect to it, and delete the old connection.
  • HTTP 422 — the request was rejected; download the latest version from SniperJournal (Settings → Connections).
  • "Could not reach the server (code 1001)" — check the URL, the Allow WebRequest list, and your internet.

Watch the full setup

That's MetaTrader 4 done — connect once, and re-run the script whenever you want your journal up to date. From there, SniperJournal turns that history into your calendar, tags, win rate and the rest. And if you also trade on MetaTrader 5, its agent syncs every trade on its own — no re-running anything — which we cover in a separate guide.

Follow SniperJournal on YouTube and X for new video walkthroughs and product updates.

FAQ

Does MetaTrader 4 sync automatically like MetaTrader 5?

No. MT4 is a manual import — you run the Backfill script yourself and paste your token each time. Continuous, hands-off auto-sync is MetaTrader 5 only, using its Expert Advisor.

Why do I have to paste the token every time I run it?

MT4 doesn't keep script inputs between runs the way MT5's Expert Advisor does, so each run needs the token again. It's always safe to re-run — trades already in your journal are skipped.

Does the script need my broker password or place any trades?

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

The script says "market closed" or "no closed trades" — what now?

Two quick fixes: right-click the Account History tab and choose "All History" so the script can see your trades, and run it with the market open (or untick GMT auto-detect and set your broker's offset, usually 2 or 3).

Does it work with my broker and on a Mac?

Any desktop MetaTrader 4 works, because it reads your terminal's local history rather than the broker's API — even brokers without one. On a Mac it runs through Wine with the same file; just paste the token with right-click → Paste, because Cmd+V doesn't work in that dialog.

SniperJournal

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

Ready to try it?

Free to use. No credit card required.