Discussing the article: "Introduction to MQL5 (Part 30): Mastering API and WebRequest Function in MQL5 (IV)"

 

Check out the new article: Introduction to MQL5 (Part 30): Mastering API and WebRequest Function in MQL5 (IV).

Discover a step-by-step tutorial that simplifies the extraction, conversion, and organization of candle data from API responses within the MQL5 environment. This guide is perfect for newcomers looking to enhance their coding skills and develop robust strategies for managing market data efficiently.

We will start by combining all the opening times from the many candles into a single array. Previously, when we retrieved and cleaned the data from the API response, the opening time of each candle was stored separately. To make them easier to access and process, we now combine them into a single structured array rather than keeping them apart. We generate a correct timestamp sequence that corresponds to the candles' order by storing all opening times in a single array. Working with time-based computations, such as seeing patterns, calculating the intervals between candles, comparing dates, or coordinating the times with other candle elements like the open, high, low, or close prices, becomes considerably simpler as a result.

Every part in the array has its own index in arranging the elements of a particular candle. As an example, index 0 contains the first candle's opening time, index 1 contains the second candle's opening time, and so forth. Printing the array once everything has been stored enables you to visually verify that the times are accurately grouped and ordered. The basis for sorting the remaining candle data is laid by this straightforward yet crucial step. The open prices, high prices, low prices, closing prices, and volumes will all follow the same pattern following the opening timings. As you deal with more candles or more sophisticated techniques, your MQL5 scripts get easier to scale, your code becomes easier to understand, and your analysis becomes cleaner by grouping comparable data together.

Recall that we divided the server response into a daily candle string array and eliminated any unnecessary characters in the previous part. The comma was used as a delimiter to divide each candle's data into distinct elements. We haven't yet indicated which location within each split array corresponds to the opening time, though. Before we group anything, we must first determine that.

Author: Israel Pelumi Abioye

 
I like your WebRequest series. May I ask how to use it for backtesting and live trading? Using custom symbols?
 
Jiang Huang #:
I like your WebRequest series. May I ask how to use it for backtesting and live trading? Using custom symbols?
Thank you. Watch out for the next article