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 — 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 ZIP works — "Open Data Folder" may open a Wine file explorer instead of Finder, but every other step 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 — its currency has to match your MT4 account — add an optional label, and click Connect. This is the same screen for MT4 and MT5; 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 Connect.

SniperJournal shows you a connection token once. 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. The panel also shows the URL you'll allow in your terminal.

The token appears once — copy it before closing the panel. In MT4 you'll re-paste it on every run.

Step 2 · Install the script in MetaTrader 4

Download the agent ZIP and unzip it, then open the MT4 folder. The only file you need is SniperJournalBackfill.ex4 — the .mq4 and .mqh next to it are just the source (you don't have to copy the whole folder), and the README is the printed version of this guide.

Inside the MT4 folder: SniperJournalBackfill.ex4 is the file you install — the rest is source and the README.

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.

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 the connection 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 SniperJournal the 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.

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).
  • HTTP 422 — the request was rejected; download the latest ZIP from SniperJournal.
  • "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.

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 ZIP.

SniperJournal

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

Ready to try it?

Free to use. No credit card required.