Skip to main content

Hiring an MQL5 Developer: Spec, Source Code Ownership and Test Plan

Transitioning to algorithmic trading requires more than just a profitable strategy. Learn how to draft an MQL5 functional spec, secure your source code, and stress-test your Expert Advisor.

Kenji Watanabe

14 min read

Hiring an MQL5 Developer: Spec, Source Code Ownership and Test Plan Watch the video

This article

8sections 14min

  1. 01 What You'll Learn, minute 2, about 1 min
  2. 02 How Do You Write an Unambiguous MQL5 Functional Spec?, minute 2, about 2 minAn unambiguous MQL5 functional specification is a highly detailed document that translates your trading rules into absolute mathematical…
  3. 03 What Defensive Trading Logic Must You Specify in the Brief?, minute 4, about 2 minDefensive trading logic refers to the safety protocols programmed into an EA to handle hostile market conditions, broker-side execution…
  4. 04 Why Must You Demand Full .mq5 Source Code and Includes?, minute 6, about 2 minDemanding full .mq5 source code means explicitly contracting the delivery of the raw, editable text files containing your strategy's logic…
  5. 05 How Do You Build a Rigorous Acceptance Test Plan?, minute 7, about 2 minA rigorous acceptance test plan is a structured sequence of historical and live-market evaluations designed to expose logical flaws…
  6. 06 Post-Delivery Verification: Presets, WebRequests, and Live Account Hardening, minute 9, about 2 minPost-delivery verification is the final security and optimization audit performed on the delivered code to ensure it contains no malicious…
  7. 07 Conclusion, minute 11, about 1 minHiring an MQL5 programmer does not require programming literacy, but it demands engineering discipline. By drafting a spec that treats edge…
  8. 08 Frequently Asked Questions, minute 13, about 1 minAn .mq5 file is the uncompiled, human-readable source code that contains the actual programming logic of your strategy. An .ex5 file is the…

Listen to this article

Also on Apple Podcasts

Listen (audio)

Hiring an MQL5 developer is the process of contracting a programmer to build a MetaTrader 5 trading algorithm. This requires a deterministic functional specification, guaranteed ownership of uncompiled .mq5 source files, and a three-phase acceptance test plan to ensure the final product executes exactly as intended without unhandled runtime errors.

You just paid $500 for a custom Expert Advisor, but it is opening trades three seconds late and the developer has stopped replying to your messages. Worse, you only have the compiled binary file, meaning no one else can fix the code. Transitioning from manual trading to algorithmic execution should not mean losing control of your strategy. Here is how to lock down your project scope, protect your intellectual property, and rigorously test your new EA before risking live capital.

What You'll Learn

How Do You Write an Unambiguous MQL5 Functional Spec?

A flowchart showing the lifecycle of hiring an MQL5 developer: Spec Drafting -> Escrow Funding ->.mq5 Code Delivery

An unambiguous MQL5 functional specification is a highly detailed document that translates your trading rules into absolute mathematical and logical conditions. If your spec leaves room for interpretation, your developer will have to guess your intentions, inevitably leading to scope creep, budget overruns, and dispute cycles.

Indicator Triggers vs. Bar Close Execution Architecture

The most common miscommunication in EA development involves execution timing. You must eliminate execution ambiguity by defining exact triggering events. Does the EA evaluate conditions on every incoming tick (intrabar evaluation), or does it wait for a confirmed candle close (bar index [1] evaluation)?

If you want a moving average crossover to trigger a trade, a tick-based EA might fire multiple false signals as the current unclosed candle fluctuates. Specifying "execute only on confirmed bar close" forces the developer to code the logic using historical, finalized price data rather than volatile live ticks. If you are incorporating advanced scalping techniques utilizing tick charts, your spec must explicitly demand intrabar processing.

Position Sizing, SL/TP Mathematics, and Multi-Timeframe Logic

Never use vague terms like "use a trailing stop" or "risk a small amount." Document explicit mathematical formulas for stop-loss and take-profit calculations in points, pips, or ATR multipliers.

Example: If you enter EUR/USD (for illustration, at 1.0850), your spec should read: "Stop Loss = Entry Price - (1.5 × 14-period ATR). Take Profit = Entry Price + (3.0 × 14-period ATR)."

Additionally, map out any multi-currency or multi-timeframe dependencies. If your H1 entry requires an alignment with the D1 trend, detail exactly how the EA must handle asynchronous data synchronization between those charts to avoid "array out of range" errors when historical data is temporarily unavailable.

What Defensive Trading Logic Must You Specify in the Brief?

Defensive trading logic refers to the safety protocols programmed into an EA to handle hostile market conditions, broker-side execution failures, and platform disconnects. A profitable strategy is useless if it panics during a momentary spread widening.

Slippage, Spread Widening, and Partial Fill Protocols

You must instruct the developer to architect MT5 order structures (using MqlTradeRequest and MqlTradeResult) to account for differing execution modes, specifically netting versus hedging environments. More importantly, define hard limits for broker-side spread expansion.

Warning: Without a maximum spread filter, your EA might execute a breakout trade during a low-liquidity rollover period, entering the market 15 pips away from your intended price.

Your brief should include explicit instructions for retry logic. If a trade is rejected due to a requote, the EA should use an exponential backoff sequence (e.g., retry after 1 second, then 2 seconds, then 4 seconds) rather than spamming the trade server and locking up the terminal thread.

A visual comparison of two candlestick charts
On-tick execution processes multiple mid-candle triggers, while bar close execution triggers once at the end of the candle.

Magic Number Isolation and Order State Tracking

Every EA must assign a unique identifier to its trades. Mandate isolated Magic Numbers and custom trade comments per symbol and strategy. This prevents cross-chart contamination, ensuring that an EA running on GBP/JPY doesn't accidentally manage or close manual trades you opened on the same pair. Furthermore, specify that the EA must track order states persistently, so if your VPS reboots, the algorithm recognizes its existing open positions upon startup.

Why Must You Demand Full .mq5 Source Code and Includes?

Demanding full .mq5 source code means explicitly contracting the delivery of the raw, editable text files containing your strategy's logic, rather than just the compiled executable file that MetaTrader runs.

.mq5 vs .ex5: The Threat of Developer Lock-In

When a developer compiles an MQL5 program, it generates an .ex5 binary file. MetaTrader 5 can run this file, but humans cannot read or edit it. If you accept only an .ex5 file, you are entirely locked in to that specific developer.

If a future MetaTrader update deprecates a specific function, or if you simply want to edit the EA's source to tweak a parameter, you will be powerless without the .mq5 file. Always stipulate in your initial brief that the final milestone payment is contingent upon the delivery of the uncompiled .mq5 file, alongside any proprietary .mqh include headers the developer used to build it.

Navigating MQL5 Freelance Escrow, IP Clauses, and the 10% Fee

If you use the official MQL5 Freelance platform, you are protected by their escrow system. Funds are held securely until you confirm the job is complete.

Understanding the intellectual property defaults is critical. Under MQL5 Freelance rules, copyright transfers exclusively to the client only upon formal deliverable acceptance and escrow release, while the developer retains a personal non-exclusive license. When negotiating the total price, remember that the platform deducts a 10% service commission upon order completion, which developers often factor into their bids.

How Do You Build a Rigorous Acceptance Test Plan?

A rigorous acceptance test plan is a structured sequence of historical and live-market evaluations designed to expose logical flaws, execution errors, and memory leaks before an EA is trusted with real capital.

Strategy Tester Stress Testing on Real Ticks

Phase 1 begins in the MetaTrader 5 Strategy Tester. Do not accept backtests run on "Open prices only" or "1 minute OHLC." Demand that the EA is tested using "Every tick based on real ticks" with modeled latency and variable spreads. This simulates the friction of live markets. If your strategy involves entering a setup with a lower-timeframe structure shift, tick-level accuracy is the only way to verify the logic triggers correctly.

A folder structure contrasting a locked padlock over an.ex5 file versus an open
A comparison between compiled .ex5 binary files with restricted access and editable .mq5 source code offering full ownership.

Forward Demo Deployment and Journal Log Auditing

Phase 2 requires deploying the uncompiled build onto a low-latency VPS connected to a live demo environment. Let it run across varied market sessions (Tokyo, London, New York) for at least a week to observe how it handles session transitions and rollover liquidity gaps.

Phase 3 is log inspection. The EA might look profitable on the chart, but beneath the surface, it could be throwing silent errors. Audit the Experts and Journal tabs for trade server error codes.

Pro Tip: Watch closely for TRADE_RETCODE_REQUOTE (10004) and TRADE_RETCODE_SLIPPAGE (10044). If these appear frequently without the EA handling them gracefully, the code is incomplete.

Finally, conduct stress drills. Manually restart the terminal and deliberately disconnect the internet. Confirm the EA recovers its existing position states without spawning orphaned orders.

Post-Delivery Verification: Presets, WebRequests, and Live Account Hardening

Post-delivery verification is the final security and optimization audit performed on the delivered code to ensure it contains no malicious external calls and is properly tuned for your specific broker's cost structure.

Sanitizing WebRequests and Hardcoded Variables

Before loading an EA onto a live account, open the .mq5 file in MetaEditor and use the search function to look for WebRequest(). This function allows the EA to communicate with external servers. While legitimate for news filters, unscrupulous developers can use it to insert remote licensing kill-switches.

Simultaneously, audit the code for hardcoded variables. Ensure all operational constants—such as lot steps, risk percentages, and trading time windows—are exposed cleanly as inputs. The developer should provide .set files, which are preset templates containing optimized parameter configurations for specific currency pairs.

Parameter Presets (.set) and Cost-Tuned Broker Deployments

An EA's mathematical edge is highly sensitive to trading friction. You must evaluate the algorithmic performance against variable spreads and commission drag. A scalping EA might be wildly profitable on a zero-spread feed but bleed capital on a standard account.

Once validated, transition your EA to a live environment calibrated to its specific needs. For example, using an NX Flex account, you can build your own trading environment by adjusting two dials. You can scale commissions from $9 down to $0 per lot, and adjust spread markups from 2.5 pips down to a 0.0 pip markup (the raw market spread still applies). With 72 possible combinations and a minimum deposit calculated strictly from your chosen terms (ranging from $10 up to the $10,000 crown tier), you can match your account's exact cost structure to the trade frequency of your new EA.

Conclusion

A three-step testing pyramid. Base: Strategy Tester (Tick Data). Middle: Forward Demo (VPS). Top: Log Auditing (Error Codes)
A three-tier MQL5 test plan covering historical strategy testing, forward demo testing, and terminal log auditing.

Hiring an MQL5 programmer does not require programming literacy, but it demands engineering discipline. By drafting a spec that treats edge cases like spread widening, partial fills, and bar-close execution as mandatory architecture, you eliminate costly scope misunderstandings before development begins. Never compromise on ownership: secure your uncompiled .mq5 source files and every dependent .mqh library so your intellectual property remains fully maintainable regardless of developer availability.

Enforce a non-negotiable acceptance protocol using historical tick backtests, log-audited demo forward runs, and safety checks on external calls before releasing escrow funds. Once your Expert Advisor is validated, pair it with an execution environment calibrated to its algorithmic edge—such as an NX Flex account, where you can dial spreads down to a 0.0 pip markup (the raw market spread still applies) or fine-tune commissions to eliminate transaction drag.

Are your EA specifications rigorous enough to protect your trading capital before the first line of code is written? Download our free MQL5 Functional Specification Template and audit checklist to structure your next programming project with total technical and legal clarity.

Trading CFDs involves risk of loss; better terms do not change market risk.

Frequently Asked Questions

What is the difference between an .mq5 and .ex5 file?

An .mq5 file is the uncompiled, human-readable source code that contains the actual programming logic of your strategy. An .ex5 file is the compiled binary version that MetaTrader 5 runs; it cannot be edited, meaning you need the .mq5 file to make future updates.

How do I protect my intellectual property when hiring an MQL5 developer?

Always use a platform with an escrow system and clearly state in your job description that 100% of the copyright transfers to you upon completion. Refuse to release the final milestone payment until you have received and verified the raw .mq5 source files.

What is a Magic Number in MetaTrader 5?

A Magic Number is a unique integer assigned to trades opened by a specific Expert Advisor. It allows the EA to identify and manage its own positions without interfering with manual trades or orders placed by other algorithms running on the same account.

How much does it cost to hire an MQL5 developer?

Costs vary widely based on complexity, ranging from $30 for a simple indicator modification to thousands of dollars for a multi-timeframe, multi-currency trading system. The MQL5 Freelance platform requires a minimum starting budget of $30 for any project.

End of article

General information and education, never investment advice.

CFDs are complex, leveraged instruments with a high risk of losing money rapidly. 64% of retail investor accounts lose money trading CFDs with this provider.

Written by Kenji Watanabe.

Technical Analysis Lead

All articles by Kenji
Publisher
FXNX Global Markets Ltd
Company
Saint Lucia 2025-00128
Published
October 16, 2026

Next step

Now practise it,
on a demo.

Open an account and practise with virtual money on live prices. No deposit, no ID.

$10,000
Demo balance, ready on your first visit. Or pick $1,000 or $100,000.

Demo results don't predict live results.