Skip to content

Use MT5 from code without Windows or a VPS

Updated 2026-11-10

You can use MT5 from code on macOS, Linux or a serverless function if another machine runs the terminal for you. The official MetaTrader5 Python package ships for Windows only and talks to a terminal on the same machine, so by itself it needs a Windows computer left running. FiveSocket hosts the terminal instead. You link your login once, then call a REST API or connect an assistant over MCP from any operating system. You can turn your computer off and your code still works.

7-day free trial. Paid plans start at $9.99 a month. See pricing

Why MT5 usually needs Windows

The MetaTrader 5 desktop terminal is a Windows application. The MetaTrader5 package on PyPI only publishes Windows wheels, and it connects to a running terminal on the same computer. It has no way to reach an MT5 server by itself.

So if you automate MT5 yourself, you need a Windows machine or VPS. The terminal has to be installed, logged in and running before any code can talk to it.

How a hosted terminal changes that

FiveSocket runs the official MT5 terminal on Linux servers under Wine. Your code never touches it. You send an HTTPS request, FiveSocket opens or reuses a session for your account, and you get the answer as JSON.

A logged-in terminal instance belongs to one account while it is in use. Before FiveSocket reuses that slot for anyone else, it stops the terminal and deletes the account's files.

What you need

  • An MT5 login, its password, and the exact server name from your MT5 terminal. The name must match exactly.
  • Any computer, server or function that can send HTTPS requests.
  • A FiveSocket account. Link your MT5 account and try it free, no card: 24 hours or 100 calls, whichever comes first. Then a 7-day free trial, card required. Cancel anytime. The trial includes one connected MT5 account.

Get started

  1. Start a trial

    Sign up and confirm your email to start your 7-day free trial.

  2. Link your MT5 account

    Enter your login, password and exact server name in FiveSocket. Use your investor password for read-only access.

  3. Use it from anywhere

    Create an API key and call https://api.fivesocket.com/v1, or add https://api.fivesocket.com/mcp to your assistant.

Other ways to avoid running Windows at home

  • A rented Windows VPS keeps the terminal online for you. You still install it, update it and keep it logged in.
  • Wine on Linux or macOS can run the terminal and a Windows build of Python. You maintain that setup yourself.
  • A hosted bridge such as FiveSocket runs the terminal for you, and you pay per account.

Limits

  • FiveSocket opens a terminal session when you make a request and closes it after a few minutes idle. It does not keep a terminal running for you all day.
  • It does not run Expert Advisors, custom indicators or your own MQL5 code.
  • It has no price stream, so your code cannot react to each tick.
  • Your broker's terms still apply. Check its rules on API access and automated trading before you link a live account.

Alerts from TradingView can still place orders if a relay such as n8n forwards them to the REST API. Send TradingView or n8n alerts to MT5

Frequently asked questions

Can I use the MetaTrader5 Python package on a Mac or Linux?
Not directly. PyPI only has Windows wheels for it. You would need Wine with a Windows build of Python and a terminal, or a hosted API instead.
Do I need a VPS to automate MT5?
Only if you run the terminal yourself. With a hosted API, your code can run anywhere that can send an HTTPS request.
Does my computer need to stay on?
No. FiveSocket runs its own terminal, and your program can run wherever you like.
Can I run my Expert Advisor this way?
No. FiveSocket does not run EAs or MQL5 code. Keep the EA on a terminal you control, or rewrite its logic in a program that calls the API.
Can I call it from a serverless function?
Yes. Each call is an ordinary HTTPS request. Allow for several seconds on the first read after a session has gone idle.
How much does it cost?
Plans start at $9.99 a month for one MT5 account. Link your MT5 account and try it free, no card: 24 hours or 100 calls, whichever comes first. Then a 7-day free trial, card required. Cancel anytime. The trial includes one connected MT5 account.

Try it on your own account.

Link your MT5 account and try it free, no card: 24 hours or 100 calls, whichever comes first. Then a 7-day free trial, card required. Cancel anytime. The trial includes one connected MT5 account. Cancel before the trial ends and you are not charged. A demo account is the safest place to start.

7-day free trial. Paid plans start at $9.99 a month. See pricing