Skip to content
All library documents

Asynchronous HTTP Requests in MQL5 Through Worker EAs

Article MQL5 articles

Summary

The article explains how to keep an MQL5 expert advisor responsive while it fetches data over HTTP. Since WebRequest blocks the EA’s single execution thread, incoming events such as ticks must wait while the request runs. The proposed workaround splits request submission from result retrieval and delegates blocking calls to assistant EAs running on separate charts.

A manager EA maintains the worker pool and coordinates clients, assistants, and HTTP results. Custom chart events carry references to request data stored in shared resources, allowing larger parameters and responses to move between programs. The article outlines worker assignment, result forwarding, startup discovery, and shutdown coordination. Its example reports parallel completion time matching the slowest request, while a single assistant processes requests sequentially. The approach depends on extra charts and EAs, resource-based messaging, and correct manager setup; it describes MQL5 infrastructure rather than a trading strategy or evidence of market performance. The author notes that future background services could provide a different implementation path.

Key ideas

  • WebRequest blocks the calling EA, delaying its handling of ticks and other events.
  • Assistant EAs on separate charts can perform blocking HTTP calls while the client EA remains responsive.
  • A manager assigns requests to available assistants and routes results back to clients.
  • Custom events carry resource references because request parameters and responses may exceed event payload limits.
  • With multiple assistants, requests can run in parallel; one assistant handles them sequentially.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.