← All projects

MT5 Hybrid Grid EA with Control Panel

A 7,900-line MetaTrader 5 grid EA that runs several virtual grids and a broker grid, steered by built-in SuperTrend engines and time windows from an on-chart control panel.

Client
Commodity grid trader
Year
2026
Category
Trading Systems
Stack
  • MQL5
  • MetaTrader 5

The problem

The client traded grids on crude oil and wanted one EA that could run several grids at once. Each grid should have its own lot progression and direction, be steered by trend filters, stay inside set trading windows, and be adjustable live from the chart without reloading presets.

What I built

  • Grids: two or three virtual grids plus a broker-side pending-order grid, up to 100 levels each. Each grid has its own starting lot, multiplier, max lot and order types (buy/sell stop and limit).
  • Grid engine selector: each grid can be manual, ATR-steered or steered by the second trend engine.
  • Built-in trend engines (no external indicators): classic SuperTrend, a SuperTrend on 18 selectable moving-average types, and a CCI-based variant. A second “magic trend” engine can steer specific grids, with confirm bars, restart delay, wait-for-new-direction and reverse modes.
  • Trend-to-order mapping: an up trend arms buy stops and buy limits, a down trend arms sell stops and sell limits. A flat trend (price within a set ATR distance of the line) switches to two-sided limit scalping.
  • Cycle control: money-based take-profit restart targets, two trailing profit locks and a close-old-and-reopen option.
  • Schedule: five trading windows, weekday and month filters, and configurable behaviour outside a window (delete pending orders, cancel stops, or let open positions run until they are in profit, with a timeout).
  • Control panel: an on-chart GUI to change grids, trend engines and targets live. Settings persist to files and reload after a restart.

Details

  • Tester-safe clock: time windows can use broker time, PC time, or a simulated PC time (broker time plus a fixed offset). The simulated clock behaves the same live and in the Strategy Tester.
  • Multi-instance safety: the magic number is derived from the EA file name, an instance ID and the symbol. If another copy claims the same identity, new trades are blocked. Trades left from older builds can still be adopted and managed.
  • Survives chart events: a timeframe switch or recompile resumes the running cycle instead of restarting the grid.
  • Market-ready options: a sandbox-only settings mode and auto-start in the tester, for MQL5 Market validation.