Skip to content
All library documents

Retrieving and Parsing Candlestick Data from an External API in MQL5

Article MQL5 articles

Summary

This tutorial demonstrates a data-ingestion workflow for requesting recent candlesticks from an external exchange API using MQL5’s WebRequest function. It explains how the request method, endpoint path, and query parameters specify the market symbol, candle interval, and number of records, then converts the response bytes into text. The example requests daily crypto candles and inspects the returned JSON structure, where each candle is an ordered array containing timestamps, OHLC prices, volume, and additional fields.

The article then shows a basic string-based parsing approach: split the response at candle boundaries, remove delimiters and quotation marks, and split each candle’s fields into an array. It emphasizes inspecting the provider’s response format because APIs differ. The example output is truncated by the platform’s log limit, and the article stops before consolidating equivalent fields across candles. It offers no market analysis or evidence that the retrieved data supports a profitable strategy; robust production use would require handling response errors and format changes.

Key ideas

  • Use a GET request when retrieving data without modifying the remote resource.
  • Query parameters specify the symbol, interval, and number of candles requested.
  • Inspect the response structure to map array positions to timestamps, OHLC prices, volume, and other fields.
  • The tutorial uses string splitting and delimiter removal to separate records and fields, but does not cover production-grade error handling.

Tags

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