Home › Automation (EAs and bots) › What is WebRequest MT5
What is WebRequest MT5: a practical guide to MetaTrader 5
WebRequest is the MetaTrader 5 function that allows a program in the terminal to send a request to an external server and receive its response. It is not a strategy or a signal: it is a communication channel between the terminal and the outside world. On its own it does not improve any trade; it only determines what information can come in and go out.
What it solves and what it does not
It solves the lack of communication. An expert advisor that only sees the chart is blind to everything happening outside it. With this channel it can consult an economic calendar, the price of an asset your broker does not offer, a volatility figure or a panel where account activity can be logged. It also works in the other direction: sending information outwards.
What it does not solve is the underlying problem. It does not provide an edge by itself, does not validate an idea and does not replace any design decision.
What it is genuinely for and what it is not
Genuinely: incorporating external context into the decision-making process and leaving a trail of what the tool does. A filter that prevents trading during the window of a macro data release is a concrete, verifiable use.
What it is not for: getting signals you do not have, fixing a strategy with no edge or replicating trades from another account. The latter is done with the copy mechanisms in the sector: if that area interests you, start with copying trades and with the logic of copy trading. They are different paths and it is best not to mix them.
How it works internally, in plain words
An expert advisor in MetaTrader 5 is written in MQL5 and runs inside the terminal. When it needs data that is not on the chart, it sends a request to a specific address: it asks, waits, receives a response in text and interprets it. That response can be a number, a list of events or a simple 'OK'. From there, the program decides.
Two details explain almost all the problems. First, the terminal only allows access to addresses previously authorised in its settings; any other one returns an error even if the internet is working perfectly. Second, the request is not instant: it depends on the network, the server and its load. A program that queries on every tick generates hundreds of requests per minute and ends up being blocked by the provider.
What the program decides and what you decide
The program decides when to ask, how to read the response and what to do with it. You decide which source deserves trust, how often it is queried and — most importantly — what should happen when there is no response. That point is rarely specified and it is the one that breaks tools.
If the system does not receive data, does it stop, trade blind or wait? All three options are legitimate, but only one is the one you want. Without that decision in writing, the tool will do whatever it thinks best.
How to evaluate a ready-made tool
What to look at before using it
- Source and maintenance. Which service it queries, who maintains it and what happens if the response format changes. A free source with no known owner is a point of failure.
- Behaviour with no data. Documented, not assumed.
- Traceability. If it logs requests and errors, you will be able to diagnose. If not, you will only see that 'something is not working'.
- Authorised addresses. Check that the process is explained and that it is repeated when changing computer or server.
- Frequency. One request per candle is usually enough on higher timeframes. On every tick, almost never.
- External dependency. If the service is paid, what happens the day you stop paying for it? Does it block, or does it keep running on the last data?
- Prior test. Demo account with real data for weeks, not for a day.
| Aspect | In backtest | In a live account |
|---|---|---|
| Server response | Not reproduced, or simulated | Depends on the network and provider |
| Request latency | Zero | Tens or hundreds of milliseconds |
| Missing data | They do not appear | You have to decide what to do |
| Format change in the source | Not visible | Breaks the reading |
| Authorised addresses | Not applicable | Blocks if it is not configured |
What it can never do
It cannot invent data that did not arrive, nor can it guarantee that an external source is truthful, available or will not change. It does not turn a mediocre idea into a good one: if the underlying logic has no edge, the extra data only makes it more complex. It does not reproduce the network conditions of a live account inside a backtest, it does not eliminate slippage and it does not replace the broker's rules. And it is not a decision engine: it is a channel.
The recurring failures
The most common is the unauthorised address: the tool appears broken when in reality the terminal is blocking outbound access. Next is dependence on a free source with no plan B; the day the format changes, the system operates blindly without warning. Other recurring mistakes are querying too much, interpreting an empty field as a zero and acting on it, and assuming that the backtest includes responses that were never there. Almost all of these failures are specification issues, not technology issues.
Who should automate and who should not
It should be done by anyone who already has logic tested by hand, can describe it in one sentence and can monitor the system with some regularity. Also by anyone who trades with clear rules and seeks execution discipline. If this is your case, the starting point is to understand how an expert advisor works and review the overall picture of automation before installing anything.
It should not be done by anyone looking to replace learning, by anyone who cannot explain their rule without ambiguity or by anyone who is not going to review the system for weeks. Automating does not fix a weak strategy; it only executes faster what you had already decided.
Frequently asked questions
Can I automate without knowing how to program?
Yes. There are ready-made tools —off-the-shelf expert advisors, copy systems, closed configurations— that do not require you to write anything. What you do need is to be able to describe your rule, understand what the tool decides and what you decide, and evaluate its behaviour when information is missing. That is judgement, not programming. The technical part can be delegated; the judgement cannot.
Does the backtest guarantee future results?
No. A backtest is a simulation on past data with assumptions about execution, spread, liquidity and external responses that do not hold in the same way in live trading. It serves to rule out ideas and check internal consistency, not to predict. An excellent historical record only indicates that the logic was consistent over that period.
What happens if the terminal closes?
The expert advisor stops running: there are no requests, no management from that tool and no new decisions. Open positions remain in the market with their stop if they have one. That is why many users keep the terminal on a dedicated server and, above all, that is why the design must consider interruption as a normal scenario, not as an anomaly.
Automate what already works
At the academy, expert advisors are used for what risk requires: calculating size, placing stops and respecting limits. Never to guess the market.
Keep reading
- EAs and bots for MT5: what they are and how they are used
- Copying trades between MT5: how it is done and what goes wrong
- Synthetic copy trading on MT5: what is copied and what is not
- How an EA works inside MT5