# How the Trader Journal EA Sends Trades to Your Phone

> The EA inside MetaTrader is what makes automatic sync possible. Here is exactly how the data flows from your trade execution to your phone screen.

**Tags:** ea, expert-advisor, automatic-sync, how-it-works

**URL:** https://traderjournal.app/app-features/how-trader-journal-ea-sends-trades-to-phone

---


# How the Trader Journal EA Sends Trades to Your Phone

The automatic sync between MetaTrader and Trader Journal happens through a small Expert Advisor that runs inside your MT4 or MT5 terminal. Understanding how this works helps you troubleshoot issues and appreciate what the system does for you.

## The Architecture in Plain Terms

When you close a trade in MT4, several things happen within seconds:

1. MT4 records the trade as "closed" in the account history
2. The Trader Journal EA detects the new closed trade
3. The EA sends the trade data to the Trader Journal API over HTTPS
4. The API stores the trade in your account database
5. Your Trader Journal mobile app shows the new trade on your next screen refresh

For MT5, the process is faster because MT5 notifies the EA immediately via OnTradeTransaction when a trade closes, rather than the EA checking periodically.

## What Data the EA Sends

Every closed trade sends the following to Trader Journal:

- Ticket number (unique trade identifier)
- Symbol (EURUSD, XAUUSD, etc.)
- Trade type (buy or sell)
- Open price and open time
- Close price and close time
- Lot size
- Profit or loss in account currency
- Commission charged
- Swap charged
- Magic number (if the trade was placed by an EA)
- Comment field (any comment attached to the order)
- Account balance and equity after the trade

Open positions send a subset of this data (current price, floating P&L) on each update cycle.

## The WebRequest Requirement

The EA uses the MT4/MT5 WebRequest function to send data over HTTPS. This requires you to explicitly allow the Trader Journal API URL in MetaTrader's security settings:

Tools → Options → Expert Advisors → Allow WebRequests for listed URLs → `https://api.traderjournal.app`

This is a MetaTrader security feature that prevents EAs from making unauthorized internet connections. Without this setting, the EA runs but cannot send data.

## Security and Privacy

The data transmission is encrypted over HTTPS. Your trade data goes to Trader Journal's servers and is stored privately — only visible to your account.

The EA does not send any personally identifiable information other than what you explicitly configure (account name and API key). It does not transmit your account password or broker login credentials.

Your API key acts as the authentication token. If you suspect your key is compromised, regenerate it in Settings and update the EA's inputs in MT4.

## MT4 vs MT5 Sync Speed

**MT4:** The EA checks for new closed trades every 30 seconds. When you close a trade, it appears in Trader Journal within 0 to 30 seconds depending on when the check cycle occurs.

**MT5:** The EA uses OnTradeTransaction, which fires immediately when a trade event occurs. Trades appear in Trader Journal typically within 1-2 seconds of closing.

## What Happens If You Are Offline

If your phone is offline or the Trader Journal API is temporarily unavailable:

- Trades close normally in MT4/MT5 regardless
- The EA retries failed sends automatically
- When connectivity is restored, the EA sends any queued trades
- Your journal catches up automatically — no manual intervention needed

## Running the EA on a VPS

Many traders run MT4 on a VPS (Virtual Private Server) for 24/7 operation. The Trader Journal EA works on a VPS without any changes. Install the EA on the VPS MT4 exactly as you would on a local machine. The EA sends data from the VPS to Trader Journal's servers directly.

On a VPS, make sure the WebRequest URL is configured in that MT4 instance specifically — VPS MT4 settings are independent from your local MT4 installation.

## The One-Time Setup Benefit

Once the EA is installed and the WebRequest URL is added, no further action is required. Every trade you make from that point forward appears in your journal automatically. The discipline required is only for the optional parts — adding notes, reviewing weekly — not for data capture.

This is why automatic sync matters so much for journal consistency. The hardest part of journaling is not analysis; it is capturing the data reliably for long enough to have meaningful statistics.
