DEV Community

KlevAi Quantitative Research
KlevAi Quantitative Research

Posted on Originally published at klevai.co.uk

Engineering Notes: MT5 Server Forensics: How Prop Firms Detect EAs via ORDER_REASON_EXPERT

Canonical Source Notice: This technical brief is a condensed summary of our full research paper originally published at https://www.klevai.co.uk/blog/how-prop-firms-detect-ea-magic-numbers-order-reason-expert-vs-client.

Problem Statement: how prop firms detect expert advisors mt5

Traders buy 'Stealth EAs' that set MagicNumber=0 and clear order comments, unaware that the MT5 terminal kernel hardcodes ORDER_REASON_EXPERT at the C++ protocol level whenever OrderSend() is invoked by an .ex5 script.

Inside the MetaQuotes Manager API: why disguising an MQL5 bot's Magic Number as '0' still fails prop firm auditsโ€”and why native OS hardware mouse clicks pass every forensic inspection.

Telemetry & Architecture Benchmark

When engineering our 5-Agent Quantitative War Room for Spot Gold (XAUUSD), we benchmarked standard retail/EA execution against native OS hardware execution:

Forensic Inspection Field Standard Commercial EA 'Stealth' MQL5 Bot (Magic=0) KlevAi Zero-EA Hardware Clicker
MT5 Kernel ENUM_ORDER_REASON ORDER_REASON_EXPERT (Instant Flag) ORDER_REASON_EXPERT (Still Flagged!) ORDER_REASON_CLIENT (100% Manual Flag)
Expert ID (Magic Number) Shared Vendor Integer 0 (Spoofed) 0 (Genuine Client GUI Ticket)
Order Dispatch Timing Jitter Exact 1msโ€“5ms Tick Sync Fixed Sleep() Delay Randomized 1.5sโ€“8.0s Human Curve

Architectural Implementation

Eliminating .ex5 execution scripts completely. KlevAi's Local Companion operates outside the terminal process, driving physical OS cursor movements and One-Click Trading clicks so the MT5 kernel natively stamps ORDER_REASON_CLIENT.

  1. Pre-Trade Risk Sentinel: Enforces a hard -3.8% daily equity circuit breaker well inside the standard -5.0% prop firm daily drawdown limit.
  2. 50/50 Twin-Order Scaling: Splits every 0.06L setup into 0.03L (TP1 at +60 pips) and 0.03L (Runner ratcheted to Breakeven + 5 pips).
  3. Zero-EA Native GUI Clicker: Dispatches OS-level mouse and keyboard events (ORDER_REASON_CLIENT) with randomized human timing jitter.

๐Ÿ”— Full Paper & Interactive XAUUSD Drawdown Calculator

Explore the complete 2,000-word breakdown and run the interactive JavaScript lot-size & drawdown buffer calculator on the canonical research page:

Top comments (0)