Project summary
I need an MQL5 Expert Advisor (EA) named “The Oracle” — a high-speed scalping robot that can open and close market trades within seconds. The EA must be optimized for minimal latency and reliable, deterministic closure logic (time-based close in seconds). Deliverables: MQ5 source code, EX5 compiled file, short user guide, and test results (Strategy Tester Every Tick + VPS live test screenshots).
Primary goals
• Open market orders immediately when entry conditions are met.
• Close trades automatically after a user-defined number of seconds (default 2s), or earlier if TP/SL is hit.
• Retry and force-close logic to guarantee closure even with slippage/freeze.
Platform & accounts
• MetaTrader 5 (MT5) — must run on hedging & ECN accounts.
• Support 4- and 5-digit brokers.
• Should be tested on a Windows VPS (developer must provide VPS test screenshots/video).
Core features & behaviour (must implement)
1. Entry modes (user-selectable via Inputs):
• Instant Entry Mode: opens a trade immediately when enabled (BUY / SELL / BOTH).
• Spike Trigger Mode: open when price moves ≥ SpikePoints within SpikeSeconds.
• Indicator Hook (optional): MA crossover / RSI threshold (developer implements hooks so indicators can be toggled on/off).
2. Exit modes (user-selectable via Inputs):
• Time-based close (Primary): CloseAfterSeconds (default 2). EA must close the trade X seconds after it is opened.
• TakeProfit / StopLoss (points) — close if TP/SL hit before time expiry.
• Combined mode: close after seconds OR on TP/SL.
• Emergency forced closure: if Close request fails (trade still open due to requote, freeze, slippage), EA retries every 200 ms until closed or config max retries reached.
3. Order execution
• Use market orders only.
• Minimal internal delays between signal detection and OrderSend.
• Respect broker MaxSlippage parameter; if spread > MaxSpread do not open trades.
4. Risk & lot sizing
• Fixed lot input (LotSize).
• Optional AutoLot: RiskPercent (calc on balance or equity).
• MaxDailyLoss and MaxOrdersPerDay protections.
5. Trade management
• MagicNumber input.
• AllowMultipleTrades (true/false).
• Check for existing trades with same MagicNumber before opening (if restricted).
• Trade comment string input.
• Ability to run multiple EA instances on different symbols.
6. Reliability & protections
• Validate and fix invalid stops if broker rejects them.
• Handle off-quotes and error codes (log and retry behavior).
• Option to pause on news / high spread / market freeze.
7. UI / On-chart display
• Show: EA status, mode, spread, active trades count, next auto-close countdown (seconds), last error.
• Simple buttons: Enable/Disable trading, Manual Close All.
8. Logging & notifications
• Log each open/close attempt with timestamps and error codes.
• Optional push notifications / desktop alerts for opens/closes/errors.
Inputs (example defaults)
• MagicNumber = 2025
• AllowBuy = true; AllowSell = true
• EntryMode = Instant / Spike / Indicator
• SpikePoints = 30; SpikeSeconds = 2
• CloseAfterSeconds = 2
• TakeProfit = 10 (points)
• StopLoss = 20 (points)
• LotSize = 0.01; AutoLot = false; RiskPercent = 1.0
• MaxSpread = 20 (points)
• MaxSlippage = 5 (points)
• MaxOrdersPerDay = 10
• RetryCloseIntervalMs = 200; MaxCloseRetries = 50
Performance & testing
• Must be optimized to minimize CPU/indicator overhead.
• Provide Strategy Tester reports (Every Tick mode) for at least 3 symbols and multiple timeframes showing open/close within seconds functionality.
• Provide a short recorded live test (or VPS screenshots) showing a trade opened and closed in seconds on a real broker (or demo ECN with realistic conditions).
Acceptance criteria
• EA opens a market order within milliseconds of the trigger being met (reasonable broker-dependent latency).
• EA reliably closes trades after CloseAfterSeconds (2s default) in at least 95% of timed tests on the chosen broker/demo; for failures the EA must attempt forced retry until closed.
• No unhandled errors; all errors logged and communicated via alerts if enabled.
• Clean, commented MQ5 source code and compiled EX5 delivered. All rights transferred to client.
Deliverables
1. MQ5 source and EX5 compiled file.
2. Readme / quick user manual explaining inputs and operation.
3. Strategy Tester reports (Every Tick) + at least one VPS/demo live test proof (video or screenshots).
4. 30 days bug-fix support after delivery.
Ownership & warranty
• Client retains full IP rights.
• Developer guarantees the code is original (no copied proprietary code) and will fix critical bugs found in the 30-day support window.