Connecting darwintIQ to MetaTrader
MetaTrader Integration with darwintIQ API
Allow WebRequest
In both MT4 and MT5, you must allow the darwintIQ API URL:
- Open Tools → Options → Expert Advisors
- Enable “Allow WebRequest for listed URL:”
- Add:
https://darwintiq.com - Click OK, then reattach the EA.
EA Workflow (High-level)
- Poll
/api/tradersevery N seconds with your desiredsymbol,sort, andsignals. - Parse the top-ranked trader (or the one with the most recent signal).
- Map
lastSignal.signalType(BUY/SELL), apply risk rules (SL/TP from your manager) and place orders. - Optionally use
potentialPipsandfitnessto confirm or throttle trading. - For production, use a JSON parser library in MQL for robustness.
Examples here use naive string parsing for simplicity.
Example Expert Advisors
We provide minimal Expert Advisor (EA) examples for MT4 and MT5. Download darwintiq-metatrader-ea-kit.zip (includes MT4/MT5 EAs, bundled JSON header for MT4, and a README)
Both EAs:
- Expose inputs for
SymbolParam,SortParam,SignalsParam, andPollSeconds. - Call
WebRequestto fetch/api/traders. - Log the first trader’s
fitness,lastSignal.signalType,lastSignal.signalTime, andpotentialPips. - Include placeholders where you can implement order placement (
OrderSendin MT4 / trade functions in MT5).
Notes & Best Practices
- Replace naive string parsing with a lightweight JSON parser for MQL.
- Add risk management: lot sizing, stop-loss, take-profit, max spread/slippage, and trading windows.
- Implement duplicate-signal suppression to avoid opening multiple identical positions.
- Test in Strategy Tester before using live.
Example Request
GET https://darwintiq.com/api/traders?symbol=EURUSD&sort=fitness