MT5 backtest diagnosis

MQL5 Strategy Tester No Trades

When the MQL5 Strategy Tester shows no trades, prove the execution path in order: OnInit succeeds, the selected mode generates the events your EA uses, enough history and indicator data are available, the entry condition becomes true, and the request passes OrderCheck and OrderSend. A zero-trade result is a symptom, not one error code.

Open the Coding Agent and choose MQL5 from the language menu.

Backtest gate logging.mq5
void OnTick()
  {
   static datetime last_bar=0;
   datetime bar=iTime(_Symbol,_Period,0);
   if(bar==0 || bar==last_bar) return;
   last_bar=bar;

   bool ready=Bars(_Symbol,_Period)>100;
   bool signal=ready && EntrySignal();
   PrintFormat("bar=%s ready=%s signal=%s",
               TimeToString(bar),ready ? "true" : "false",
               signal ? "true" : "false");
   if(signal) SubmitCheckedRequest();
  }
  • First gate: OnInit succeeds
  • Next: signal becomes true
  • Then: request passes checks
  • Finally: server retcode is logged

Also searched as: mt5 backtest no trades.

Trace the first gate that stays false

Add one concise log at initialization, event entry, data readiness, signal evaluation, request precheck, and send result. The first missing or false gate defines the next investigation.

GateEvidenceTypical correction
InitializationOnInit return and JournalFix handle, input, or resource setup
EventsOnTick or OnTimer counterChoose a compatible tester mode and handler
DataBarsCalculated and copy countsWait for required history and buffers
SignalNamed condition valuesFix impossible filters or time comparisons
RequestOrderCheck resultRepair volume, price, stops, or filling
Server outcomeMqlTradeResult.retcodeHandle permission, market, funds, or connection

Check tester-specific behavior

The Strategy Tester simulates events and data according to its mode. The official testing reference documents tick generation, indicator calculation, history loading, time behavior, and functions that are not executed in tests. Match the test mode to the EA assumptions.

  • Confirm the date interval contains bars for the selected symbol and timeframe.
  • Avoid Math calculations mode for an EA that expects ticks and trading.
  • Use visual or ordinary single tests when investigating Print output hidden during optimization.
  • Ensure custom indicator dependencies are available to test agents.

Do not change the strategy until the gate is known

Loosening every condition can create trades while hiding a data or request bug. First prove that each input has the expected value. Then change only the condition that is incorrect according to the strategy specification.

Use a focused diagnostic

The trace shows whether ticks produce new-bar decisions, history is sufficient, and the signal branch is reached. EntrySignal and SubmitCheckedRequest must log their own data and trade results.

Backtest results depend on code, data, tester mode, costs, symbol settings, and parameters. A repaired zero-trade test does not establish profitability or predict live performance.

Backtest gate logging.mq5
void OnTick()
  {
   static datetime last_bar=0;
   datetime bar=iTime(_Symbol,_Period,0);
   if(bar==0 || bar==last_bar) return;
   last_bar=bar;

   bool ready=Bars(_Symbol,_Period)>100;
   bool signal=ready && EntrySignal();
   PrintFormat("bar=%s ready=%s signal=%s",
               TimeToString(bar),ready ? "true" : "false",
               signal ? "true" : "false");
   if(signal) SubmitCheckedRequest();
  }
Where Pineify fits

Repair editable MQL5 source with compiler feedback

Pineify can generate or revise MQL5 source and use MQL5 compilation diagnostics during the coding workflow. Keep the exact error, source location, program type, and intended behavior in the request so the change remains reviewable.

Open MQL5 Coding Agent

Pineify does not run your broker terminal, Strategy Tester, market data, or live orders. Validate the final program in your own MetaTrader 5 environment.

Review MQL5 AI Coding Agent capabilities
Pineify MQL5 AI Coding Agent with an editable MetaTrader 5 code artifact

A practical verification workflow

  1. 1

    Confirm initialization

    Read the Journal and make every required handle, dependency, and input fail explicitly in OnInit.

  2. 2

    Trace events and data

    Log event counts, server/test time, bar counts, BarsCalculated, and exact CopyBuffer returns.

  3. 3

    Expose signal gates

    Name and print each boolean or threshold that blocks entry on a small test interval.

  4. 4

    Check the request outcome

    Log OrderCheck, OrderSend, GetLastError, result.retcode, and result.comment.

Frequently asked questions

Why does my MQL5 Strategy Tester show no trades?

The usual diagnostic categories are failed initialization, missing events or data, a signal that never becomes true, an invalid request, or a rejected trade. Logs should identify the first failing gate.

Why does my MT5 backtest have no orders but no error?

A strategy can legally produce no request if its conditions never pass. Log the evaluated condition values and event counts, not only GetLastError.

Does Pineify run the MT5 Strategy Tester?

No. Pineify can help generate or revise MQL5 source and work through compilation diagnostics. Run behavioral backtests in your own MetaTrader 5 environment.

Last verified against the linked official references on . Compile and test the final source in the MetaTrader 5 build, broker, symbol, and account environment you plan to use.

Continue with reviewable MQL5 source

Provide the exact diagnostic and intended behavior, inspect the generated change, compile it, and verify it in your MT5 test environment.

Open MQL5 Coding Agent