Same MT4 EA, Different Trades: Backtest vs Demo Explained

Published Updated

2 monitors showing different chart patterns beside the same software cube

An MT4 backtest vs demo comparison often surprises traders because the same EA can open different trades in each environment. That difference does not automatically mean the source code changed or that the platform is broken. It usually means the test conditions, quote flow, or execution rules were not identical.

The important question is not whether the trade lists match perfectly. Instead, ask which inputs, market data assumptions, and runtime limits shaped each decision. If you compare only the equity curve, you can miss the reason a specific entry moved, disappeared, or shifted by a few points. This article breaks down the main causes and shows how to compare them carefully.

It also helps to avoid shortcuts that lead to false conclusions. An ex4 decompiler cannot prove why a trade appeared in one run and not the other, and a compiled file alone does not reveal the full decision path. Therefore, the safest analysis stays with documented settings, observed behavior, and the rules the tester and terminal actually use.

Different Trades Do Not Mean Different Source

When an EA behaves differently in a backtest and on demo, the first mistake is assuming the MQ4 logic must be different. In many cases, the compiled EX4 runs the same rules in both places. However, the environment changes the data it sees and the actions it can take.

A binary file is not plain text source, so a visible difference in outcomes does not prove that the source changed. Likewise, a plausible MQ4 text generated by any tool is not proof that the original code was recovered. Therefore, focus on inputs, time, symbol conditions, and execution rather than guessing about the file itself.

This is also where contract and ownership issues matter. Possessing an EX4 file does not give automatic rights to modify it, and no article should suggest bypassing protections. If you need to understand the intended settings, start with the documented parameters and the program design notes, not reverse engineering.

A better question is whether the same logic received the same market context. If a rule depends on the previous bar close, a live stream may deliver that moment differently than a modeled test. Therefore, the source can stay identical while the resulting trades diverge.

Historical Modeling and a Live Quote Stream

A backtest uses historical data and a modeling method. A demo account uses a live quote stream from the broker. Those two data sources are related, but they are not the same thing. Therefore, the EA can evaluate the same strategy rule against different price paths.

MetaTrader 4 strategy testing is also more structured than live operation. Setup includes EA inputs, symbol, timeframe, modeling method, and dates as separate test settings. That matters because a change in any one of them can alter the sequence of signals. For example, a moving average cross may appear at a different bar if the history set differs.

Standard MT4 tester behavior does not use automatically real recorded ticks in the way many newcomers assume. It models ticks from available history and the selected modeling method. As a result, the test is useful for logic inspection, but it should not be treated as a live quote replay. Never promise live outcomes from a test.

The same chart can therefore tell two different stories. In the tester, a bar may be built from modeled movement that never matches the live tick order. On demo, however, the broker feed can trigger an entry earlier or later because the arriving ticks differ. That is why a direct one-to-one comparison needs caution.

Spread Assumptions Can Change Entries

Spread is one of the simplest reasons for a mismatch. In the tester, MT4 uses Ask based on the selected spread, and the current spread at the start often becomes the default. On demo, the spread changes with the live market and broker conditions. Therefore, the entry line can move even if the signal bar looks identical.

This effect is most visible for EAs that enter close to a threshold. For example, a buy may trigger when Ask crosses a level, while the chart shows only Bid. If the assumed spread is wider in the test, the entry might never happen. If it is narrower on demo, the trade can appear earlier.

That is why basic price precision matters. For many forex symbols, a 5-digit quote means 1 point is 0.00001 and 10 points equal 1 conventional pip. However, pip and point conventions are not universal for metals, indices, or every symbol. If you want a clearer framework, see mq4 pips vs points for the precision trap that often causes false comparisons.

The spread effect also changes exits and stop placement. A stop loss set too tightly may appear safe in one environment and vulnerable in another. Therefore, a small spread difference can alter the full trade path, not only the entry. That makes symbol precision a practical issue, not a formatting detail.

Check Symbol, Period, and Inputs First

Before comparing trade lists, verify that both runs used the same symbol and timeframe. A small difference there can change every signal. Even if the EA name is identical, a chart attached to EURUSD M15 is not comparable with one attached to EURUSD H1.

Next, inspect the input values. Many EAs change behavior through extern or input parameters such as lot size, stop distance, session filter, or indicator period. Also confirm the time window. A backtest using one date range cannot be compared fairly with a demo run from another market phase.

This is where a mq4 project readme is useful. A clear README should state the intended symbol, period, parameter defaults, and any data assumptions. If the developer documentation is missing, your comparison becomes guesswork. Therefore, record the exact setup before you inspect trade differences. Otherwise, you may chase a mismatch that came from a simple configuration error.

It also helps to compare the chart template, if one exists. Some EAs rely on attached indicators, chart objects, or symbol-specific settings. If the demo chart loads with a different broker symbol suffix, the data feed itself may change. That is another reason to verify the environment before blaming the logic.

Execution Rules and Order Timing Matter

Even with matching inputs, order timing can differ. A tester fills orders according to its simulation rules, while demo trading depends on live server responses and market timing. Therefore, one run can open on the same bar but at a different price, or miss a fill that the tester accepted.

This matters for pending orders, stop orders, and market entries near fast moves. The EA may check conditions once per tick, once per bar, or by timer logic. If the live stream arrives with a different tick sequence, the order decision can shift. Also, order placement may fail temporarily because the quote moved before the request reached the server.

OrderMagicNumber helps identify orders, but it does not enforce order isolation by itself. It is only an identifier. Therefore, if an EA and another script share a symbol, you still need to inspect the trade logic and timing. A matching magic number does not guarantee the same execution path in both environments.

Execution rules also affect re-quotes, slippage, and order rejection. The tester may accept a path that live execution cannot replicate exactly. Consequently, a trade may look valid in the backtest yet fail to appear on demo. That is often a timing issue, not a strategy mistake.

Tester Restrictions on External Functions

The strategy tester does not behave like the live terminal in every respect. WebRequest and several external communication functions do not execute in the tester. That means an EA that downloads data, contacts a server, or depends on outside confirmation can produce different results in backtest and demo.

Time functions also deserve attention. In the tester, TimeLocal, TimeCurrent, and TimeGMT coincide in simulated time. Live operation is different, so code that depends on timezone relationships may behave differently outside the tester. Therefore, a filter that looks fine in backtest can shift during live demo trading.

TimeCurrent itself reflects the last known broker server quote time, not the computer clock. That detail matters when the EA schedules logic or checks whether market time is open. If the program expects live server timing, a simulated test may not expose every real-world edge case. Consequently, external dependencies should be documented before you trust the result.

These restrictions matter even when the chart looks simple. A file lookup, server handshake, or remote permission check may be silent in the tester and active on demo. Therefore, the backtest can complete normally while the demo run waits, skips, or blocks a trade. That difference is structural, not accidental.

A Trade Seen in Only One Run

Consider a hypothetical EA that opens a buy when the fast average crosses above the slow average and Ask stays below a resistance level. In the tester, the selected spread is small, so Ask reaches the entry condition at 10:15. The trade opens. On demo, the spread widens at the same moment, so Ask remains above the resistance filter. No trade appears.

That example is hypothetical, but it shows a common pattern. The chart may suggest the same breakout happened in both runs, yet the actual entry condition used Ask, not Bid. Therefore, the trade list differs even though the source logic did not change.

A similar mismatch can happen with stop orders or session filters. For example, a bar-based rule may pass in the tester, but the live tick arrives after the allowed session ends. The result is one trade in one environment and none in the other. The difference lies in timing and assumptions, not necessarily in code.

This is why a single missing trade should not trigger broad conclusions. First identify the exact condition that failed. Next compare the quote, spread, session time, and order type. Finally, decide whether the cause was environment mismatch or a real logic defect.

Compare Decisions, Not Just Profit Curves

A profit curve is useful, but it hides the path. Two runs can show similar profit while using different entries, different exits, or different lot progressions. Conversely, two runs can diverge sharply in equity while only one early trade differs. Therefore, compare the decision chain first.

Start with the signal bar, then the price reference, then the spread, and finally the execution result. If you know when the rule fired, you can see whether the trade was blocked by a filter or delayed by market movement. Also check whether the EA used a new bar or an intra-bar tick to make the decision.

This approach is especially helpful when an iCustom call is involved. iCustom returns values from a custom indicator, but parameters, buffer selection, and bar shift all matter. If any of those differ, the EA can read another buffer value and make a different choice. So, the trade list alone is not enough evidence.

For deeper precision analysis, the same principle applies to pip measurement. A change of 10 points may mean 1 pip on a 5-digit forex quote, but not on every symbol. Therefore, compare the exact numbers the EA sees, not only the visual candle shape.

What a Useful Discrepancy Report Includes

A good discrepancy report should capture the setup, not just the outcome. Include the symbol, timeframe, modeling method, date range, spread assumption, and all EA inputs. Also note whether the run was on demo or in the tester. Without that context, a developer cannot isolate the difference efficiently.

Next, record the exact trade event. State the timestamp, entry type, price, and the condition the EA was expected to satisfy. If possible, include the broker server time from the terminal and the tester settings used in the run. Because TimeCurrent refers to server quote time, that detail can matter when diagnosing time filters.

Finally, describe what happened just before the divergence. For example, was the spread wider, did a session filter block the trade, or did a custom indicator return an unexpected buffer value? A useful report avoids vague claims like “the EA is different.” Instead, it shows the exact decision point where the two runs separated.

If you need a structure for collecting that information, use a mq4 project readme as the model. A short, clear record saves time later because it preserves the exact assumptions behind the result. That makes the comparison repeatable instead of emotional.

Why a Short Match Does Not Prove Anything

It is tempting to trust a short demo run when it matches a backtest for a few trades. However, a brief match only shows that the conditions aligned for that segment. It does not prove the EA will keep matching across new data, different spreads, or another server feed. Market structure can change quickly.

Likewise, a strong tester result does not guarantee live behavior. The tester uses simulated time and modeled ticks, and it cannot reproduce every execution delay or external dependency. Therefore, a short agreement between environments should be treated as a confirmation of setup, not as proof of future performance.

The practical conclusion is simple. Use the MT4 backtest vs demo comparison to validate logic, document assumptions, and spot data issues. Then keep expectations limited to what each environment can actually show. If you need a reminder about documentation discipline, the 1-Page MQ4 README Your Next Developer Will Thank You For is the right companion guide.

In the same spirit, keep expectations for symbols and precision realistic. A chart that matches today can still drift tomorrow because spread, session liquidity, and server timing change. Therefore, a useful comparison looks for repeatable causes, not one lucky alignment.