MT4 Bot Trading: How It Works and How to Set It Up

MT4 bot trading

mt4 bot trading and all you need to know about it

Key Takeaways

  • MT4 bot trading runs through Expert Advisors. An EA written in MQL4 opens, manages and closes trades inside the MT4 desktop terminal for as long as it stays open.
  • Bots cannot run on the MT4 phone app. Run the EA on a Windows computer or a VPS, and use your phone only to monitor trades.
  • Setup takes a few minutes. Copy the EA into the MQL4 Experts folder, attach it to a chart, tick Allow live trading and switch on AutoTrading.
  • Risk settings matter more than the strategy. At 1% risk, a $2,000 account with a 25 pip stop on EUR/USD trades 0.08 lots, and every setup should run on demo first.

MT4 bot trading means letting an Expert Advisor (EA), a program written in MQL4, open, manage and close trades in MetaTrader 4 for you. The bot runs inside the MT4 desktop terminal on a Windows computer or VPS, follows fixed rules, and only trades while MT4 is open and connected.

Below we cover how an MT4 bot works, what you need, how to set one up step by step, and where the limits are.

How MT4 Bot Trading Works

An EA is attached to one chart and reacts every time a new price arrives. Each cycle follows the same four steps:

  1. Read the market. The EA receives the latest bid and ask price from your broker through MT4.
  2. Check its rules. It tests indicator values, price levels, time of day and its own risk limits.
  3. Send orders. When the conditions match, it opens a trade with a set lot size, stop loss and take profit.
  4. Manage and close. It tracks open positions, moves stops if it uses a trailing stop, and closes trades when its exit rules are met.

EAs come as .ex4 files (compiled, ready to run) or .mq4 files (source code you can read and edit in MetaEditor). Most commercial bots ship only the .ex4 file.

What You Need Before You Start

You need Why it matters
The MT4 desktop terminal from your broker EAs only run in the desktop terminal; the MT4 phone apps cannot run them
A Windows computer or VPS that stays on The bot stops trading when the computer sleeps or loses internet
A broker account that allows EAs Some accounts limit hedging, and US accounts must close trades in FIFO order
The EA file (.ex4 or .mq4) This is the bot itself
A demo account It lets you watch the bot’s behavior before any real money is at risk

How to Set Up an MT4 Trading Bot, Step by Step

  1. Install MT4 from your broker’s website and log in to a demo account.
  2. Open File, then Open Data Folder, and go to MQL4, then Experts.
  3. Copy the EA file into the Experts folder.
  4. In the Navigator panel, right click Expert Advisors and choose Refresh.
  5. Open a chart of the symbol and timeframe the EA was built for, then drag the EA onto it.
  6. In the Common tab, tick Allow live trading. In the Inputs tab, set the lot size or risk and the other settings.
  7. Switch on the AutoTrading button in the toolbar. A smiley face in the top right corner of the chart means the EA is active.

If nothing happens, open the Experts and Journal tabs at the bottom of the terminal. They show every error the EA reports, such as a rejected order or a spread that is too wide.

The Settings That Matter Most

Every EA has its own inputs, but these six decide most of your risk:

Setting What it controls Safer starting point
Lot size or risk % How big each trade is Risk 1% or less per trade
Stop loss The most a single trade can lose Always on; avoid EAs that trade without one
Take profit Where a winning trade closes Larger than the stop, or managed by a trailing stop
Maximum open trades How many positions can run at once Low enough that all stops together stay under your limit
Magic number Which trades belong to which EA A different number for every EA on the same account
Trading hours and news filter When the EA is allowed to trade Off during high impact news

Worked example: sizing a bot on a $2,000 demo account

Say your bot trades EUR/USD with a 25 pip stop and you want 1% risk. That is $20 per trade.

One standard lot of EUR/USD moves about $10 per pip, so a 25 pip stop costs $250 per lot. Your lot size is $20 ÷ $250 = 0.08 lots.

If the EA can hold 3 trades at once, the worst case with every stop hit is $60, or 3% of the account. Our guide to the 1 and 90 rules in forex trading shows why keeping that number small matters over a losing streak.

Test it in the Strategy Tester first

MT4 has a built in Strategy Tester under View, then Strategy Tester. Pick the EA, the symbol and the period, and choose Every tick for the most detailed model.

Treat the result as a rough guide. MT4 builds its ticks from minute data, so the test misses real spreads and slippage, which is why a few weeks on a demo account still matter.

Why an MT4 Bot Is Not Trading

Problem Usual cause Fix
No smiley face on the chart AutoTrading is off Click the AutoTrading button in the toolbar
Sad face on the chart Live trading is not allowed for this EA Tick Allow live trading in the EA’s Common tab
EA loads but never trades Wrong symbol name, such as EURUSD.m instead of EURUSD Check the symbol the EA expects in its settings
Orders rejected Spread above the EA’s limit, or the market is closed Read the Journal tab and wait for normal trading hours
Trading stops overnight The computer went to sleep Change power settings or move MT4 to a VPS

A VPS keeps MT4 running when your own computer is off. This guide explains when a VPS is worth it for a forex bot.

MT4 or MT5 for Bot Trading?

MT4 is still widely used for forex bots, but MT5 has a stronger toolset for testing. The two platforms use different languages, so an MT4 EA will not run on MT5 without being rewritten.

Feature MT4 MT5
EA language MQL4 MQL5
Strategy Tester Single symbol, ticks modeled from minute data Multi symbol, real tick data and faster optimization
Position modes Hedging Hedging or netting
Markets Mainly forex and CFDs Forex and CFDs, plus exchange traded stocks and futures at some brokers

You can read more on our MetaTrader 4 and MetaTrader 5 pages.

Using a Prebuilt Bot Instead of Coding One

You can write an EA yourself in MQL4, but most traders start from a prebuilt bot. If you want to see how simple EAs work first, our list of free expert advisor tools for MT4 covers the ones that are still free.

XAUBOT is our own platform, so weigh this accordingly. You start from a prebuilt bot and customize risk per trade, symbols, trading hours and the news filter to match your trading style. Every bot exports for both MT4 and MT5, needs a hedging account, and can be tested free for 15 days on a demo account.

See the forex trading bot or gold trading bot pages for the details.

MT4 Bot Trading Questions

Can I run an MT4 bot on my phone?

No. The MT4 phone apps cannot run EAs. Run the bot on a Windows computer or VPS and use the phone app to watch trades.

Do I need to know how to code?

No. You only need to code if you want to build your own EA in MQL4. Prebuilt EAs install by copying a file into MT4.

Can I run more than one bot in MT4?

Yes. Each EA goes on its own chart, and each should use a different magic number. Add up the risk of every bot, as covered in running multiple forex trading bots on one account.

Is MT4 bot trading profitable?

It can be in some periods, but no bot wins in every market. EU regulators found that 74% to 89% of retail CFD accounts lose money, and automation does not change those odds by itself.

Before You Let a Bot Trade Real Money

Automated trading carries a high risk of loss, and a bot follows its rules even when the market moves against it. Keep risk per trade small, always use a stop loss, and watch the bot regularly.

A practical next step: set up one EA on an MT4 demo account using the steps above, size it at 1% risk, and run it for a few weeks. Only move to a live account once you understand how it behaves through a losing streak.

5/5 - (1 vote)

Further Reading

Leave a Reply

Your email address will not be published. Required fields are marked *

Share Post

Contents