Expert Advisor Not Working? Separate Compile Failure from the Server Code
An expert advisor that is not working has failed at one stage: compile, initialization, data, a false signal, or a trade-server rejection. A successful compile is not a filled order. MQL5 codes name invalid volume, invalid stops, insufficient funds, a closed market, and disabled trading as separate results. Record that stage in the log before you change inputs or enable extra permissions.
Key Takeaways
- Record the terminal build, EA version, input set, broker symbol, timeframe and exact error message.
- Check compilation, initialization, data, signal conditions and trade responses in that order.
- No trades can be correct behavior. Losses alone do not establish a coding defect or overfitting.
- A historical tester result does not rule out code paths that fail only during connected operation.
1. Did MetaEditor fail, or did the terminal never start it?
Confirm the file pair first. MQ5 and EX5 belong to MT5. MQ4 and EX4 belong to MT4. The wrong terminal never reaches a trade-server response. If source is available, compile the main file in MetaEditor and read its Errors tab. In the terminal, read Experts and Journal lines from the time you attached the expert advisor, and keep the exact message and timestamp. An empty Errors tab only means that compile finished.
- A successful load is different from successful initialization. Investigate missing indicators, includes, invalid inputs or explicit initialization failure.
- After an update, compare the old and new build, source and dependencies. Do not assume a platform API change without a diagnostic.
- If only a compiled program is supplied, provide the vendor with version, settings and logs. Regenerating a similar strategy does not repair or recover its original source.
2. No quotes are not the same failure as a rejected order
Check connectivity, the exact broker symbol name, and the trading session. Confirm the expert advisor has enough history and that indicator values are ready. Check terminal algorithmic trading, the program setting, and account permissions from the current labels, not from a button color alone. A closed market can mean no new quotes or a trade-server rejection. It does not always block initialization. A silent chart and a server return code are different failures.
- A closed market can mean no new quotes or rejected trading; it does not universally prevent EA initialization.
- A program can select and use additional symbols itself. Inspect how it requests and synchronizes data rather than assuming every symbol must be manually displayed.
- Enable DLL or external-request access only when the program actually requires a trusted dependency. Do not enable it as a generic fix.
- Renko implementations differ: inspect whether bricks are generated internally or provided by another chart or indicator. There is no universal attachment rule for every Renko EA.
3. Did the signal become true?
Inspect or log each condition using the exact values and bars the EA reads. A spread filter, time window, open-position check or completed-bar requirement may correctly block entry. Compare those values with the written specification. Avoid loosening thresholds merely to make trades appear.
- Record which condition returned false and the data timestamp. A missing value should not be silently interpreted as a valid zero.
- Check time-zone assumptions and whether the EA uses chart settings or explicit symbol/timeframe inputs.
- In MQL5, NewTick events can be coalesced while one is already queued or processing. Long handlers can affect what the program observes.
4. Was a trade request sent, rejected or filled?
Record the trade request and server return code. MQL5 distinguishes invalid volume, invalid stops, insufficient funds, a closed market and disabled trading. Use the exact result to investigate the matching condition. OrderSend returning true does not by itself establish that the requested trade was filled.
- Compare volume with the broker minimum, maximum and step, and price distances with current symbol restrictions.
- Check account mode and the intended order/position handling. Netting and hedging logic are not interchangeable.
- Log failure handling and retries. Blindly resending a request can create duplicates if the first result was merely delayed or uncertain.
5. Replay the server code with the same inputs
Run the same expert advisor version and inputs in the tester, then compare data, account, and execution settings with the connected chart. Tester trades and no connected trades narrow the search. They do not prove the code is correct. If the journal names a trade-server result, rerun that case before you edit the signal. Timing, missing data, and broker rules can all sit between a finished compile and a fill.
- If the expert advisor trades and loses money, compare the orders with the written rules before you call it a software failure. Win rate, profit factor, and drawdown do not diagnose overfitting.
- Broker and prop-firm rules depend on the account program and the current contract. Check automation, copying, and prohibited-strategy terms. A demo or swap-free label does not grant permission.
- With editable source, Pineify can help read that diagnostic and draft a change aimed at it. Recompile and rerun the same case in MT5. Pineify Strategy Optimizer does not debug trade-server return codes.
This page is educational and does not provide investment advice. Diagnose changes in a tester or demo environment before considering live use. Automated trading can result in substantial loss.