Why Does a Trading Robot Make Money in the MetaTrader 5 Strategy Tester but Lose on a Live Account? 7 Reasons Explained
Hello, friends! Today I want to discuss a situation that many algorithmic traders eventually encounter. You find an interesting Expert Advisor, run it through the MetaTrader 5 Strategy Tester, and receive an attractive report. The balance curve rises, the profit factor looks promising, and the maximum drawdown appears acceptable. Everything suggests that the trading system is ready for live execution.
But after launching the same Expert Advisor on a real account, the results begin to differ. Positions open at different prices, some trades never appear, and the strategy may even start losing money. Naturally, traders begin asking an important question: why does a trading robot perform well in the Strategy Tester but struggle in live trading?
After more than twenty years of experience in financial markets and automated trading system development, I have encountered this problem many times. I regularly publish educational articles through my MQL5 author profile and discuss practical trading systems in the English Trading-Go Telegram channel. Today, I want to examine this subject from a technical and statistical perspective, without unrealistic promises or claims about guaranteed profitability.
The first thing to understand is that MetaTrader 5 is a powerful testing environment. However, the purpose of the Strategy Tester is not to guarantee future profits. It is to help developers and traders investigate how an algorithm behaves under specific historical and simulated conditions.
In this article, we will examine seven major reasons for discrepancies between backtesting and live trading, calculate the impact of trading costs, and discuss how to test Expert Advisors more systematically.
1. What Does the MetaTrader 5 Strategy Tester Actually Measure?
The MetaTrader 5 Strategy Tester executes an Expert Advisor using historical market data and predefined testing conditions. The program receives price events, calculates indicators, evaluates entry and exit conditions, and performs simulated trading operations.
After the test, traders can review net profit, maximum drawdown, the number of completed trades, profit factor, expected payoff, and other statistical measurements.
This is extremely useful. Instead of waiting months for a strategy to generate a meaningful number of trades, we can study its historical behavior much more quickly.
However, a backtest is not a recording of future trading activity. It is a simulation based on known data and specified assumptions.
The live market introduces conditions that may differ from the historical sample: changing liquidity, spreads, execution delays, trading restrictions, and unexpected market developments.
Even when an Expert Advisor uses exactly the same input parameters, a relatively small difference in the initial sequence of trades can produce a substantially different result later.
This is particularly important for algorithms in which each new trading decision depends on earlier positions.
My recommendation is to treat the Strategy Tester as a research tool rather than a prediction machine. A historical report provides useful evidence, but it does not prove that a particular result will repeat in live trading.
2. Reason One: Using the Wrong Tick Modeling Mode
One of the most common sources of discrepancies is selecting a testing mode that does not accurately represent the behavior required by the trading algorithm.
MetaTrader 5 provides several modeling options, including Open Prices Only, 1 Minute OHLC, Every Tick, and Every Tick Based on Real Ticks.
These modes differ in the amount of price information used during simulation.
Open Prices Only
This is a fast modeling method that can be useful for preliminary testing of strategies that make decisions exclusively when a new candle opens.
For example, an Expert Advisor may analyze completed hourly candles and place an order only at the beginning of the next hour.
For this type of entry logic, the mode can provide a convenient initial assessment.
However, it may be unsuitable for algorithms that depend heavily on intrabar price movement.
If an Expert Advisor uses dynamic trailing stops, multiple position entries, or price-sensitive exit conditions, important events may not be represented with sufficient detail.
1 Minute OHLC
This mode represents each one-minute bar using its Open, High, Low, and Close prices.
It provides more information than a test based only on opening prices, but it does not reproduce the complete historical sequence of individual ticks.
Imagine a trading robot that moves its Stop Loss after every favorable price movement.
The exact order in which price reaches different levels can influence when the stop is moved and whether the position survives a later reversal.
A simplified OHLC sequence may not represent that behavior accurately.
Every Tick
In this mode, MetaTrader 5 generates a detailed tick sequence using historical minute data.
This offers a more detailed simulation than the simpler modes, but parts of the intraminute sequence are still generated rather than taken directly from recorded market ticks.
Every Tick Based on Real Ticks
This mode uses historical tick data provided by the broker whenever the required data is available.
It is generally the preferred mode for evaluating algorithms whose behavior depends on detailed price changes inside candles.
However, even real historical ticks do not guarantee the same result in future trading.
Historical tick coverage may be incomplete, and execution conditions in the future may differ from those observed in the past.
For this reason, I recommend using simplified modes for suitable preliminary checks and real-tick testing for more detailed final evaluation of tick-sensitive strategies.
3. Reason Two: Different Brokers Provide Different Trading Conditions
Consider a simple situation.
You backtest an Expert Advisor using EURUSD history from one broker. Then you run the same algorithm on a live account with another broker.
The financial instrument has the same name, and the strategy settings are identical.
Why can the results still differ?
The answer is that different brokers may provide different historical quotes, Bid and Ask streams, spreads, contract specifications, and execution conditions.
Even relatively small differences can affect trading signals.
Suppose an Expert Advisor places a Buy Stop order just above the previous hourly high.
Broker A records a price movement that reaches the activation level. The pending order is triggered, and the robot opens a position.
Broker B records a slightly lower high. The same pending order is never triggered.
At this point, the strategies have already taken different paths.
One version manages an open position and may activate trailing logic. The other remains outside the market and continues waiting for a new signal.
A few hours later, their trading histories may be completely different.
Broker specifications can also influence position sizing and order validity.
Important variables include minimum lot size, volume step, contract size, margin requirements, permitted execution modes, and restrictions on protective order distances.
I recommend performing the final evaluation using conditions that correspond as closely as possible to the broker and account type intended for live trading.
This is especially important for high-frequency or short-target strategies, where a small execution difference can materially change profitability.
4. Reason Three: Spread, Commissions, and Swaps Change the Economics
A trading robot can have positive expected profitability before costs and negative expected profitability after them.
To understand this, let's examine a simplified numerical example.
Suppose an automated strategy completes 100 trades.
Of those trades, 60 are profitable and 40 are losing.
The average winning trade produces $12 before additional trading costs, while the average losing trade results in a $15 loss.
The total gross profit from winning trades is:
60 × $12 = $720.
The total loss from losing trades is:
40 × $15 = $600.
The combined result is therefore:
$720 − $600 = +$120.
The system appears profitable.
Now let's add trading costs that were not represented in the original calculation.
Suppose additional commissions average $1.50 per completed trade.
Across 100 trades, the commission expense is $150.
Now assume additional spread and slippage effects amount to another $0.60 per trade compared with the original model.
That adds $60 in expenses.
The combined additional costs are:
$150 + $60 = $210.
Our trading result becomes:
$120 − $210 = −$90.
The trading rules have not changed. But the strategy has moved from a positive to a negative financial outcome.
This is an illustrative calculation, not the documented performance of any real Expert Advisor.
Nevertheless, it demonstrates why trading expenses matter so much for strategies with relatively small average profits.
MetaTrader 5 provides facilities for configuring account commissions and other testing conditions. Traders should verify which expenses are actually represented in their reports.
For algorithms that hold positions overnight, swaps can also become a meaningful component of the financial result.
I recommend testing not only the base-case expense assumptions but also reasonable adverse scenarios.
A strategy that becomes unprofitable after a small increase in trading expenses may be too sensitive for the intended trading environment.
5. Reason Four: Slippage, Execution Delays, and Rejected Orders
In live trading, an Expert Advisor does not control the exact moment at which every trading request is executed.
The algorithm detects a signal, prepares a request, sends it to the trading server, and waits for the broker's response.
During that process, market prices may change.
Suppose an Expert Advisor sends a BUY request when EURUSD is quoted at 1.10000.
By the time the request is processed, the available execution price has moved to 1.10005.
The difference is 0.5 conventional pips.
That may seem small, but for strategies that execute hundreds of short-duration trades, small execution differences can accumulate.
Other issues may include trade rejections, invalid order volumes, changed market conditions, insufficient margin, or temporary restrictions on trading.
MetaTrader 5 allows developers to simulate execution delays in the Strategy Tester.
Available options include No Delay, Fixed Delay, and Random Delay.
These settings help examine how an algorithm responds when trade requests are not processed instantly.
However, delays in a simulation do not reproduce every possible liquidity or execution event from a future live session.
Why Trade Result Handling Matters
For developers, this is an important technical consideration.
An Expert Advisor should not assume that a successfully submitted trading request necessarily means the intended operation was completed exactly as expected.
The program needs to examine trade-server return codes, actual executed volumes, position states, and relevant transaction events.
It should also respond appropriately to failures rather than repeating the same request indefinitely.
For example, if a position-opening request is rejected, the algorithm must not update its internal position count as if the trade had actually opened.
Otherwise, later decisions may be based on an incorrect representation of the account state.
In my development work, I consider reliable error handling and logging essential parts of an Expert Advisor, not optional enhancements.
6. Reason Five: Historical Overfitting
Overfitting is one of the most dangerous problems in algorithmic trading development.
It occurs when strategy parameters are selected in a way that matches a particular historical sample too closely.
Imagine an Expert Advisor with adjustable moving-average periods, ATR multipliers, trading hours, Stop Loss settings, trailing parameters, and exit rules.
A developer runs thousands of optimization passes and selects the combination with the highest historical profit.
The resulting performance may look excellent.
But how much of that result comes from a real trading advantage, and how much comes from the accidental characteristics of the historical sample?
When many parameter combinations are tested, some will inevitably perform unusually well by chance.
For example, a trend-following strategy may produce strong results during a prolonged trending period.
If its parameters were selected primarily using that period, the strategy may perform poorly during a sideways market.
How to Reduce Overfitting Risk
One useful approach is separating historical data into development and evaluation periods.
Parameters are selected using one part of the history and then evaluated on another part that was not used during optimization.
MetaTrader 5 includes forward-testing functionality for this purpose.
I also recommend examining neighboring parameter combinations.
If a small adjustment causes profitability to collapse, the configuration may be unstable.
It is useful to test strategies under different market conditions: strong trends, sideways movements, higher volatility, and lower volatility.
Forward testing does not guarantee future performance, but it helps reveal some forms of historical parameter fitting.
The objective is not to find the single most impressive optimization result. It is to investigate whether the underlying trading logic remains reasonably consistent outside the original development sample.
7. Reason Six: Software Logic Behaves Differently Under Live Events
Some differences between backtesting and live trading originate in the Expert Advisor itself.
A program may handle completed candles correctly but make mistakes when orders are delayed, partially filled, rejected, or interrupted.
These problems may not appear during a particular historical test.
For example, the EA may assume that every order request creates a new position.
During live trading, a request can fail. If the EA does not correctly process the result, its internal position counter may become inconsistent with the actual trading account.
Another common issue is maintaining critical trading information only in temporary program memory.
After a terminal restart, the program may lose information about its previous calculations unless it can reconstruct the state from actual positions, orders, and stored data.
Software Issues Worth Investigating
- Repeated entries after incorrectly processed trading requests.
- Incorrect position counting by symbol or Magic Number.
- Failure to process partial fills correctly.
- Using outdated quotes when constructing orders.
- Incorrect rounding of trading volume.
- Unexpected behavior after reconnection or restart.
- Confusion between netting and hedging accounts.
I recommend logging the key decisions made by the trading system.
Useful information includes the reason for entering a trade, the calculated lot size, current spread, intended protective levels, actual execution price, and trade-server response.
When a difference appears between testing and live execution, these records help identify the first operation that behaved unexpectedly.
Without sufficient logging, traders may incorrectly blame the market, broker, or Strategy Tester when the actual problem is inside the program.
8. Reason Seven: Account Size, Margin, and Infrastructure
An Expert Advisor tested with a $10,000 deposit may behave differently when used on a $1,000 live account.
This is particularly relevant for strategies using fixed position volumes or opening several positions simultaneously.
Leverage also influences margin requirements.
If the live account provides less available leverage, the same sequence of positions may consume more margin and reach account restrictions earlier.
Minimum volume and volume-step rules can create additional differences.
For example, a position-sizing formula may calculate 0.006 lots, while the broker requires a minimum trade of 0.01 lots.
The algorithm must decide how to handle this situation without silently exceeding the intended risk.
Operational infrastructure is another factor.
If an Expert Advisor runs on a home computer, its operation depends on electricity, internet connectivity, terminal status, and the stability of the operating system.
A VPS can help maintain a more consistent execution environment, but it cannot remove market risk or guarantee error-free trading.
When comparing a backtest with a live account, examine not only strategy parameters but also the financial and technical conditions under which the system operates.
9. Why Grid and Multi-Position Strategies Are Particularly Sensitive
Strategies that manage several positions can be especially sensitive to differences in execution.
Consider an Expert Advisor that opens an initial BUY position and adds further positions at predefined price intervals.
In a backtest, the price reaches the next entry level and the robot adds another trade.
The average entry price changes, total exposure increases, and the algorithm recalculates its exit conditions.
In live trading, a slightly different spread or quote sequence may prevent the additional position from opening, or cause it to open at another price.
Once that happens, the entire position series can evolve differently.
Future entries, average-price calculations, trailing adjustments, and exit levels may no longer match the historical simulation.
This effect can become more significant when additional position volumes depend on earlier trades.
Example: Increasing Position Sizes
Suppose a strategy opens the following volumes:
0.01 → 0.02 → 0.04 → 0.08 lots.
The combined volume is 0.15 lots.
If the next position is 0.16 lots, total exposure increases to 0.31 lots.
One additional trade has more than doubled the preceding combined position size.
During a prolonged adverse market movement, this can produce substantial drawdown and margin pressure.
Therefore, I recommend evaluating grid strategies using aggregate exposure, maximum equity drawdown, margin requirements, and behavior during extended trends.
The number of profitable position series alone is not a sufficient measure of system safety.
10. Evaluating VR Proton and Similar Expert Advisors
As an example of an automated trading system with advanced position management, we can consider VR Proton MT5.
The Expert Advisor combines trend-oriented entries with position-series management, breakeven mechanisms, and trailing-stop logic.
Its published features are described on the VR Proton MT5 product page in the MQL5 Market.
When evaluating this type of Expert Advisor, I recommend examining several aspects separately.
First, analyze the initial entry logic.
Second, examine how additional positions are opened and how their volumes are determined.
Third, study how the algorithm calculates the average entry price and manages the overall series.
Fourth, test the breakeven and trailing-stop mechanisms.
Finally, investigate what happens during prolonged adverse trends.
For strategies involving averaging, it is particularly important to understand how aggregate exposure increases and how that affects equity and margin.
I also recommend testing more conservative execution assumptions, including higher trading costs and delays.
If a system performs acceptably only under a narrow set of ideal conditions, it deserves further investigation before being used with real money.
Automated trade management can reduce the burden of manual execution, but it does not guarantee profitability or eliminate risk.
11. A Practical Experiment: Four Tests of the Same Expert Advisor
Let's move from theory to a practical testing procedure.
You can perform the following experiment using a suitable Expert Advisor in MetaTrader 5.
The objective is not to prove that the robot will make money. It is to measure how sensitive its behavior is to different assumptions.
Test One: Establish the Baseline
Choose a symbol, timeframe, historical period, account deposit, and Expert Advisor configuration.
Run a test and save the report.
Record net profit, maximum drawdown, total trades, profit factor, and relevant execution settings.
This becomes your baseline for comparison.
Test Two: Use Real Historical Ticks
Without changing the trading parameters, perform a test using Every Tick Based on Real Ticks.
If your baseline already uses this mode, no additional comparison is necessary at this stage.
Compare the number of trades, entry and exit prices, equity behavior, and maximum drawdown.
Pay particular attention to the first trade where the two tests diverge materially.
Test Three: Increase Trading Costs
Examine the effect of higher commissions and other configurable trading conditions.
Use the relevant advanced testing or symbol settings when supported.
Determine whether a reasonable increase in expenses causes a small reduction in performance or changes the strategy's overall profitability.
This is a useful stress test for systems with narrow profit targets.
Test Four: Simulate Execution Delays
Configure a fixed or random execution delay.
Compare the results with the baseline and investigate whether the trade sequence changes.
Some algorithms may be relatively insensitive to moderate delays.
Others may show significant changes in the prices and frequency of execution.
These results provide information about the robustness of the system, but they are not predictions of future live performance.
12. What Should You Compare Between Backtesting and Live Trading?
When a trading robot begins behaving differently on a live account, I recommend comparing specific variables rather than immediately drawing conclusions.
Start with the trading environment:
- Expert Advisor version and input parameters.
- Financial symbol and timeframe.
- Account currency, deposit, and leverage.
- Netting or hedging account type.
- Contract size, minimum volume, and volume step.
- Trading sessions and broker restrictions.
Then examine market and execution conditions:
- Historical and live quotations.
- Bid and Ask prices.
- Spread behavior.
- Commissions and swaps.
- Actual execution prices.
- Trade-server return codes.
- Order rejection or partial execution.
Finally, compare the trading results:
- Order sequence.
- Entry and exit timing.
- Position volumes.
- Aggregate exposure.
- Equity and balance behavior.
- Maximum drawdown.
- Margin usage.
The most useful diagnostic step is often to identify the first trade that differs between the two environments.
If an extra position appears on the live account, investigate why it was opened.
If a position was closed earlier than expected, compare the relevant Bid and Ask prices, stop levels, and execution details.
Once the first meaningful discrepancy is explained, many subsequent differences may become easier to understand.
13. Forward Testing After Optimization
Historical testing and optimization are related but distinct processes.
A standard backtest evaluates a selected set of parameters.
Optimization searches through many parameter combinations to identify configurations that perform well under a chosen criterion.
The more combinations you examine, the greater the risk of finding settings that match historical noise rather than a repeatable market characteristic.
That is why I recommend independent evaluation after optimization.
For example, you could use one historical period for parameter development and a later period for testing those parameters without modifying them.
MetaTrader 5 includes a forward-testing feature that supports this workflow.
If optimized settings perform well in the development sample but deteriorate significantly on the independent period, investigate possible overfitting or changes in market conditions.
A strong forward result does not eliminate uncertainty either.
It simply provides additional evidence that the configuration is not dependent solely on the original development sample.
For more advanced evaluation, traders can also investigate walk-forward methods and repeated testing across different market regimes.
14. Why Demo Trading Is Useful but Still Not Identical to Live Trading
After historical testing, running an Expert Advisor on a demo account can provide useful information about its behavior under current market conditions.
You can observe live quotations, monitor trading signals, review logs, and verify that the program remains operational.
This is particularly helpful for detecting software problems that did not appear during historical testing.
However, demo and live execution conditions can differ depending on the broker.
Order handling, liquidity, slippage, and other conditions may not be identical.
Manual trading behavior may also change when real money is involved.
Therefore, I recommend using demo trading primarily as a way to investigate current operational behavior and confirm that the strategy follows its intended rules.
It is an important step in the evaluation process, but not a guarantee of future live performance.
15. A Practical Checklist Before Using Real Money
Before launching an Expert Advisor on a live account, I recommend answering the following questions.
- Have I tested the robot using an appropriate tick modeling mode?
- Are the historical data and broker specifications suitable?
- Do the tests account for relevant trading expenses?
- Have I examined the effect of execution delays?
- Has the strategy been evaluated on independent historical data?
- Does the EA handle rejected orders and execution errors correctly?
- Can the program restore its state after a terminal restart?
- Is the strategy compatible with the account's position-accounting model?
- Have I evaluated maximum aggregate exposure and equity drawdown?
- Do I understand how the algorithm behaves during extended adverse trends?
- Are the account deposit and margin conditions appropriate for the strategy?
- Do I have a reliable way to monitor the trading system?
If important questions remain unanswered, further testing is more useful than rushing into live deployment.
A good historical report is only one component of a complete evaluation.
Recommendations
So why can an Expert Advisor make money in the MetaTrader 5 Strategy Tester but lose money on a live trading account?
The answer usually involves one or more differences between the simulated environment and actual market conditions.
Historical tick quality, broker quotations, commissions, spreads, slippage, execution delays, overfitting, software logic, and account specifications can all influence the final result.
My recommendation is to begin with the trading algorithm itself.
Understand why it opens positions, how it calculates volume, what happens when an order is rejected, and how it controls the combined risk of all open trades.
Then select a suitable testing mode, examine trading expenses, evaluate execution sensitivity, and test on independent historical periods.
Pay particular attention to equity drawdown. A strategy may display an attractive balance curve while holding substantial floating losses.
Do not judge a trading robot only by its best historical result or percentage of winning trades.
Evaluate the full range of possible outcomes, including unfavorable market conditions and operational failures.
Above all, remember that the Strategy Tester is not designed to promise future profits.
It is designed to help you understand the behavior of a trading system before exposing real capital to risk.
Now I would like to hear about your experience.
Have you ever used an Expert Advisor that performed well in backtesting but behaved differently on a live account?
What was the main reason: spread, slippage, broker conditions, overfitting, or an issue in the trading algorithm?
Share your observations in the comments. Practical experience supported by trading records can help other traders avoid costly mistakes.
This article is provided for educational and informational purposes only and does not constitute personalized investment advice. Trading financial instruments involves substantial risks, including the potential loss of capital. Historical test results do not guarantee future performance.
Tags: MetaTrader 5, MT5, Strategy Tester, Expert Advisors, Trading Robots, MQL5, Backtesting, Forward Testing, Real Ticks, Slippage, Trading Costs, Spread, Overfitting, Risk Management, Algorithmic Trading, VR Proton.


