An EA that works only in MT5 visual testing needs a check of whether its decision depends on data or on something drawn on a chart. A graphical object should not replace an explicit signal value. Before changing the strategy, compare modes, versions, data and the first difference in its logs. The example below does not run MT5: it is an authored model separating a number from an unavailable reading. Missing input remains unknown rather than becoming zero, and no trade is placed.

What actually differs in visual mode?

The MQL5 tester documentation states that graphical objects are not plotted outside visual testing, and queries for properties of a created object return zero values. The limitation does not apply to visual mode. This is documented platform behaviour rather than an experiment we performed on your EA. It does not establish that every discrepancy between tests has the same cause.

If an EA reads a line price or button state as an input, record that stage separately from an indicator or price data. Establish whether the value exists in that mode first. An explicit unavailable status can stop diagnosis before calculation instead of accepting a technical zero as a price. A visible chart does not confirm readiness of every input used by the strategy.

How do you separate a numeric signal from a chart object?

Authored non-trading simulation. Declare a positive numeric signal of 1.1050 and a threshold of 1.1040. The condition is “signal greater than threshold”. Compare the explicit number with an object reading marked unavailable. These are not MT5 quotations or execution logs; we chose symbolic states to demonstrate data flow.

Unavailable input is not a zero price

Unavailable input is not a zero priceAuthored simulation: signal 1.1050 exceeds threshold 1.1040. An unavailable object produces null in our model; its condition is not evaluated.Explicit number1.1050Threshold: 1.1040Unavailable objectnullNo input valueModel resulttrue / unknownNo trade requestCheck value and availability separately.Authored model — hypothetical values.
Authored simulation: signal 1.1050 exceeds threshold 1.1040. An unavailable object produces null in our model; its condition is not evaluated.
One threshold, different kinds of condition input
PathInputEvaluation
Explicit numeric signal1.10501.1050 > 1.1040: true in the model.
Unavailable objectnull: no valueThe condition is not evaluated.
Incorrect substitution0 instead of no value0 > 1.1040: apparently an ordinary false result.

The last row illustrates the faulty comparison version. The guarded path retains a missing reading as null; a separate version shows the consequence of replacing it with zero. Zero and null answer different questions: one is a number, while the other indicates missing input. Under the opposite condition, “signal below threshold”, substituted zero could even appear to satisfy the criterion. Do not repair the program by inserting an arbitrary fallback value.

Separate data from a chart object

Our teaching example runs locally in your browser: it does not connect to an account or API, send your entries or save them persistently. Do not enter passwords or personal details.

This simulates our rule, not an EA test in MT5. Use positive decimal-point numbers, 10⁻⁸–10⁸, up to 15 digits. Missing object data is null in our model; a separate faulty version substitutes zero. This does not establish the cause of your EA failure.

The tool lets you change two positive finite values. It evaluates the explicit number while leaving the unavailable-object path without a comparison result. The page reads no chart, executes no platform test and creates no investment signal. It demonstrates why diagnosis must distinguish a false condition from one that cannot be evaluated.

How do you record program mode without trading?

The MQL5 flags MQL_TESTER, MQL_VISUAL_MODE and MQL_OPTIMIZATION describe the program's environment. TERMINAL_BUILD identifies the terminal build. Record actual readings rather than assuming a tester mode from a window's appearance. That record alone does not establish identical data or parameters.

The small standalone diagnostic EA below logs configuration in OnInit and has an empty OnTick. It sends or modifies no orders. OnInit documents the initialization signature, and PrintFormat documents formatted output. Save it as a separate MQ5 file, compile it in MetaEditor and compare actual logs from your own terminal.

#property strict
int OnInit()
{
   PrintFormat("tester=%d visual=%d optimization=%d build=%d symbol=%s period=%d",
      (int)MQLInfoInteger(MQL_TESTER),
      (int)MQLInfoInteger(MQL_VISUAL_MODE),
      (int)MQLInfoInteger(MQL_OPTIMIZATION),
      (int)TerminalInfoInteger(TERMINAL_BUILD),
      _Symbol, (int)_Period);
   return INIT_SUCCEEDED;
}
void OnTick() {}

Do not create a second OnInit in an existing EA or replace its initialization with this snippet. Adding logging requires preserving the program's existing flow. Tester documentation also gives an OnInit exception to the PrintFormat restriction during optimization; missing print output from every other stage does not prove those stages were never executed.

How do you find the first difference instead of comparing profit?

Prepare a paired-run record: visual/non-visual mode, terminal and code versions, inputs, symbol and timeframe, tick-generation model, requested and actual start, data snapshot, costs and initial state. Preserve settings files and version identifiers too. If these declarations differ, do not attribute the whole change to the chart window. The two-backtest record comparator helps organise this check.

Find the earliest stage where one path has a different value: retrieval success, data timestamp, indicator readiness, signal, condition or decision. A note saying “profit 120 rather than 80” does not identify that stage. Preserve original logs and create a small comparison table beside them. Do not invent values that the program did not record previously.

Keep the diagnostic record small enough to match events in both runs. Logging everything without a stable identifier can obscure the first divergence. Record which input was requested, its timestamp or sequence position and whether the program accepted it. These are practical record-design choices, not a guarantee that a log identifies every dependency automatically.

Add an observation identifier and record which input was requested. Matching the sequences then need not rely on guessing whether similar prices came from the same stage of the test.

What should change in the signal's design?

The calculation should return an explicit value plus data-availability status; the graphical layer can display that value. Switching drawing off then need not deliberately change the input source. Check the same module on several controlled inputs, including unavailable data and a value equal to the threshold. This does not guarantee matching results for the entire tester: versions, data, costs and other code dependencies remain relevant.

“This limitation does not apply to testing in visual mode.” — MetaQuotes, MQL5 tester documentation, graphical-objects section; accessed 13 October 2026.

Without source code, send the EA author your paired-run record and the first documented divergence. Do not replace diagnosis with a sequence of live trial orders. The MT4 and MT5 backtesting guide covers general test preparation.

What to do tomorrow

  1. Complete a paired-mode record. Preserve code and terminal versions, inputs, data and range for one pair of runs. Mark unconfirmed fields. The same EA file does not establish that all other settings match or that the data used in each run are identical.
  2. Distinguish no value from zero. Run our model with signal 1.1050 and threshold 1.1040, then set equal values. Check that an unavailable object remains null regardless of the comparison result for explicit numeric inputs. This does not require a trading account.
  3. Record the first divergent stage. In a separate demo configuration or tester, gather non-trading diagnostic entries and compare their sequence. Establish whether input, availability or the condition changed. The diagnostic description neither proves profitability nor provides an investment recommendation.