Organizing API Candle Data into Time and Price Arrays in MQL5
Summary
The article shows how to turn candle data returned by an external API into arrays that are easier to analyze in MQL5. After splitting the response into per-candle fields, it identifies the positions for opening time and OHLC prices, then groups comparable values across candles into separate arrays. It demonstrates converting millisecond timestamps to seconds and then to MQL5 datetime values, while price strings are converted to numeric values.
The examples use five daily candles and show array indexing and printed output as a basic way to inspect ordering. The intended benefit is simpler access for comparisons, calculations, indicators, or later trading logic. This is a data handling tutorial rather than a trading method: it offers no performance evaluation or strategy results. The pasted examples also appear to contain a repeated day reference in the low-price assignment, so readers should verify field-to-day mapping and validate parsed data before relying on it.
Key ideas
- The API response is split into fields for each candle before values are extracted.
- Corresponding candle elements can be grouped into separate arrays for time and OHLC data.
- Millisecond timestamps must be converted to seconds before storing them as MQL5 datetime values.
- Price strings are converted to numeric values for downstream analysis.
- Printed arrays help inspect ordering, but the examples should be checked for indexing and assignment errors.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.