Darwinex Labs publishes open-source MQL5 library to split DARWIN providers' MT5 orders
Darwinex Labs said on 20 May 2026 that it released an open-source MQL5 library that splits a DARWIN provider's MT5 market orders into several sequential child orders to reduce slippage and support capacity scores. The tool is published under Apache 2.0 as alpha software, with the company warning it has not been tested across brokers, symbols or live conditions.
What the library does
According to Darwinex Labs, the library takes the lot size an expert advisor (EA) intends to trade and divides it into N parts that are fired sequentially with a configurable delay. The EA sends the first order as usual; the library then submits the remaining orders, each carrying the same stop loss as the original. The company says the aim is to avoid one large aggregate order hitting the order book at once, which it links to wider fills and a lower capacity score. On exit, the handling differs by path. If the first position hits its stop loss, each child position carries its own broker-side stop loss and closes independently, with no action from the library. If the first position closes by take profit or manually, the library detects this and closes the remaining children one at a time with the same delay. If a child order is rejected or requoted, the library retries a configurable number of times, then skips that slice and logs its volume. Darwinex Labs said the library reads each symbol's filling mode property and selects IOC, FOK as fallback, or RETURN as last resort. On lot rounding, it floors each child to the symbol's lot step and assigns the remainder to the first order; the company's example divides 0.30 lots four ways on a 0.01 step as 0.09 plus three orders of 0.07, preserving total volume. If the per-child size would fall below the minimum lot, the split count is reduced automatically, and if splitting is impossible the order is sent unsplit.
Integration and configuration
The library ships inside an Include/SplitOrder/ folder containing SplitOrder.mqh, SplitOrderConfig.mqh and a StrategyQuant X adapter, SplitOrderSQX.mqh. Darwinex Labs said there are no DLLs or external dependencies, and described integration as three added lines in the EA. It also said the library works with EAs built on the CTrade class because it only needs the resulting ticket, and that child orders are sent via MqlTradeRequest so the EA's own trade.ResultXxx() values are unaffected. Settings sit in a SplitConfig struct with these stated defaults: splitCount 3 (usable from 2 to 10), delaySeconds 10, slippage 5.0 points, maxRetries 3, retryDelaySeconds 2, a magic number that should match the EA's, and verbose logging enabled by default. The company said delaySeconds should reflect instrument liquidity, noting major FX pairs recover in seconds while exotic crosses or thin CFDs might need 15–30 seconds. A SplitCancelAndClose() function stops pending child entries and sequentially closes open split positions for end-of-day closes or signal reversals. A test EA is included, SplitOrder_TestEA.mq5, which the company said opens a random EURUSD buy or sell every minute when no position is open, with symmetric 20-pip stop loss and take profit, on a Darwinex demo account at default settings of 0.05 lots split into three orders 10 seconds apart.
StrategyQuant X adapter and stated limits
For strategies generated with StrategyQuant X, Darwinex Labs said it ships an adapter providing openPositionSplit() with the same signature as SQX's openPosition(), making integration a find-and-replace exercise. Market entries are split; pending orders, exit-level orders and orders too small to split pass through unchanged. The first order still routes through SQX's own openPosition(), which the company said preserves margin checks, duplicate detection, the sqHandleTradingOptions gate, pending order replacement logic and SQX's retry mechanism. Darwinex Labs noted that child orders bypass the sqHandleTradingOptions gate because they are fired by the library rather than openPosition(), which it said matters only when a child would fire across a gate boundary and is a narrow edge case at typical 5–30 second delays; it suggested avoiding entries in the last minute before an SQX cutoff. The company listed three v1 limitations: one active split per direction, so two simultaneous longs are not supported (a long and a short split can run at once); child orders are always market orders, with no splitting of pending orders; and state is held in memory only, so if MetaTrader restarts mid-split the remaining children will not fire and the EA will hold a partial position.
Alpha status and Darwinex's stated rationale
Darwinex Labs described the code as alpha, not battle-tested across brokers, symbols or live market conditions, and said users are responsible for reviewing the source, running it on a demo account and verifying behaviour before deploying real funds. The company stated that authors and contributors accept no liability for trading losses, execution errors, partial fills, missed closes, slippage or broker rejections, and that the library is provided "AS IS" without warranties, referring to Sections 7 and 8 of the Apache License 2.0. It said the code is on GitHub at marticastany/darwin-capacity-optimiser. In its rationale, Darwinex Labs described capacity as the ceiling on investor AUM a DARWIN can absorb before performance degrades, and said its Labs team uses that measure when allocating the INDX master fund across the DARWIN pool, with weak capacity hard-capping allocation. The company said INDX is growing with institutional capital in its pipeline and that its ability to deploy that money is limited by the supply of DARWINs with capacity headroom rather than by demand for allocation. Those are the company's own characterisations; the announcement does not publish capacity scores or allocation figures. The post states that Darwinex Zero and the domain www.darwinexzero.com are trade names used by Tradeslide Technologies, a company registered in the United Kingdom under number 14398381, and that the blog and video content are for educational purposes only and not financial or investment advice.
Article information
This article draws on the cited sources and relevant public material. It may include summaries, translations or supporting analysis and does not replace the full announcement, regulatory document or dataset. Check facts, definitions, statistical methods and effective conditions against the original source, particularly where a translation differs.
Companies, broker brands and legal entities must be distinguished. A licence, permission or announcement concerning one entity should not automatically be applied to related brands, other entities, products or jurisdictions. Reporting and commentary do not constitute investment advice, trading recommendations or assurances of safety, compliance or suitability.
Information is time-sensitive: announcements, register entries and data may be updated or revised. The publication and update dates on this page refer to this website’s article record and may differ from the event or original release date. Before acting, check current source material, the applicable jurisdiction and your actual contracting entity.