MetaTrader 4 Expert Advisor: Install, Check and Test an EA
An MT4 expert advisor is an MQL4 program that can analyze market data and send trade requests in MetaTrader 4. MQ4 is source code; EX4 is the compiled program. Correct installation and trading permissions are necessary for operation, but they do not establish that the rules are correct or profitable.
Key Takeaways
- MT4 needs MQL4/EX4. MT5 source and executables cannot be used by changing their file extension.
- Current MQL4 supports OnTick and other event handlers; legacy start-based examples are not the only programming model.
- Pineify has a dedicated MQL4 coding workflow that downloads MQ4 source.
- Inspect individual orders and tester assumptions before interpreting a performance summary.
Install the right artifact in the right terminal
Use the MT4 terminal data folder for the account installation you intend to use. Place an EA in MQL4/Experts, with required dependencies in their appropriate locations. If you have MQ4 source, open it in MetaEditor and compile it; resolve errors and inspect warnings. Refresh Navigator or restart the terminal if the program is not listed.
- Check that the vendor or project actually targets MT4. EX5 belongs to MT5 and cannot run as an EX4.
- Attach the EA to its intended chart, inspect inputs and check its initialization messages.
- Review terminal AutoTrading and the EA trading permission. Enable external dependencies only when required and trusted.
- Do not treat an icon or successful load as proof of a fill; inspect Experts, Journal and account orders.
Understand when the EA processes data
Current MQL4 documents OnTick for new quotes. If a quote arrives while the previous OnTick handler is still executing, that new event is not queued for the EA. Legacy code may use start(), but it is incorrect to present it as the only MT4 event handler or to promise that every incoming tick is processed.
- The EA can use chart symbol/timeframe values or explicitly request others; inspect its implementation.
- Turning off AutoTrading blocks EA trade requests but does not stop event processing. It does not close existing positions.
- Signal timing, history availability and checks for existing orders determine whether a new trade request is appropriate.
Review trading assumptions before comparing MT4 and MT5
MQL4 order APIs and MQL5 order/deal/position APIs differ. MT5 also distinguishes netting and hedging account modes; it is inaccurate to describe every MT5 account as one universal position model. Porting an EA requires adapting these behaviors and retesting it.
- Use the broker symbol precision, lot limits, tick values and account currency when calculating orders and planned risk.
- Do not assume every pair or timeframe needs the same inputs or that one strategy family is universally better for it.
- Price, support terms and source availability are separate considerations. Free or paid status alone does not establish quality.
Use MT4 Strategy Tester with its actual limits
Record the EA version, inputs, symbol, timeframe, date range, spread and account assumptions. MT4 offers Open prices only, Control points and Every tick modes. Its Every tick mode models ticks from available lower-timeframe data; it is not evidence of complete recorded historical tick execution.
- Inspect the Results, Report and Journal, and use visual testing to compare orders with expected rules.
- Document the configured spread. The standard tester uses a selected spread assumption; it does not reproduce every future spread, requote or liquidity condition.
- MT4 tester restrictions include trading only the tested symbol and no WebRequest execution. A multi-symbol or external-data EA may therefore behave differently in a tester.
- Keep historical, demo-account and live results separate. There is no supported universal percentage by which live win rates fall below backtests.
Draft MQL4 source with Pineify
Pineify has a dedicated MT4/MQL4 coding workflow. Describe the exact rules and request a reviewable EA source artifact. Its code download uses MQ4 for this workflow. Compile the source with the MT4 MetaEditor and test its behavior before considering connected trading.
- Specify MQL4/MT4 explicitly so the project uses the intended platform APIs.
- Review generated order handling, sizing and exits. Syntax diagnostics do not guarantee correct behavior.
- Pineify Strategy Optimizer operates on TradingView strategies, not MT4 EAs. Pine Script is a separate environment, not a substitute executable for MT4.
This page is educational and does not provide investment advice. Examples describe test requirements, not proven strategies. Automated trading can result in substantial loss.