MT4 error 65: Invalid account (ERR_INVALID_ACCOUNT)
The server doesn't accept this account number for trading. It may be wrong, closed, or on another server.
What it means
You see this code in GetLastError() in MQL4, after a trade function fails on the server side.
The trade server doesn't recognise the account as one that can trade here.
It points at the login or the server, not at the order.
An account belongs to one trade server. The same number on another server is a different account, or no account at all.
Common causes
- An account signed in to the wrong server.
- An account that was closed or archived.
- A login copied with a typing mistake.
How to fix it
- Check the account number and the exact server name.
- Copy the server name from the terminal's login dialog, not from memory.
- Ask the broker whether the account is still active.
Example in MQL4:
Print("account ", AccountNumber(), " on ", AccountServer(),
", connected: ", IsConnected()); Is it safe to retry?
No. Fix the login or server first; the same request fails the same way.
Could the order have executed?
No. The server didn't recognize the account, so nothing was traded.
How Tickwire handles it
Tickwire treats it like MT5 10017, and the MT4 code stays in the message. See trade results.
Related codes
One API for MT4 and MT5
Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.