MT4 Expert Advisor: Compile MQ4 to EX4 and See Which Ticks Ran
An MT4 expert advisor is an MQL4 program that can read prices and send trade requests in MetaTrader 4. MQ4 is the source you compile, and EX4 is the file the terminal runs. Renaming an MT5 EX5 to EX4 does not load it. If a new quote arrives while OnTick is still running, MT4 does not queue that event, and a correct install still does not make the rules 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.
MT4 OnTick drops a quote that arrives mid-handler
Current MQL4 documents OnTick for a new quote on the chart. If the next quote arrives while that OnTick call is still executing, MT4 does not queue the new event for the expert advisor. Older source may call start(). That function is a legacy handler, not the only MT4 handler, and neither one means every incoming tick was 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.
An EX4 does not inherit MT5 netting or hedging
MQL4 order functions are not the MQL5 order, deal, and position functions, so an EX4 cannot borrow an MT5 account mode. MT5 distinguishes netting and hedging. It is inaccurate to treat every MT5 account as one position model, and it is inaccurate to expect the MT4 tester to apply that model. A port rewrites the order calls and needs a new test on the terminal that will run the file.
- 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.
MT4 Every tick mode models prices. It is not a saved tick tape
Record the EX4 version, inputs, symbol, timeframe, dates, spread, and account assumptions before you read a report. MT4 offers Open prices only, Control points, and Every tick. Every tick builds ticks from lower-timeframe prices that are available. It is not a replay of recorded historical fills.
- 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.
Download MQ4 from the MT4 workflow, then compile the EX4
Pineify has a dedicated MT4 coding workflow. Describe the rules and ask for reviewable MQL4 source. The download in this workflow is MQ4, not MQ5 and not a finished EX4. Compile that MQ4 in the MT4 MetaEditor and test the EX4 before any connected trading.
- Name MQL4 and MT4 in the request so the source calls MT4 order functions rather than MQL5 order, deal, and position APIs.
- Read the generated order, size, and exit code. A clean compile does not prove the EX4 sent a valid request.
- Pineify Strategy Optimizer operates on TradingView strategies, not MT4 expert advisors. Pine Script is not an EX4 you can place in MQL4/Experts.
This page is educational and does not provide investment advice. Examples describe test requirements, not proven strategies. Automated trading can result in substantial loss.