Specification
Hello,
I'm looking for a developer with expertise in MQL5 programming. I need help creating an indicator for the MetaTrader 5 platform that loads data from a CSV file hosted remotely. The indicator is a dashboard on the following format: PAIR / SIGNAL (SELL/NEUTRAL/BUY)
Your task is to perform the following:
-
Write an MQL5 script that uses the WebRequest() function to fetch a CSV file from a specified URL. This CSV file contains data that has been written to Google Sheets by a Python script and is hosted on a server. Please, note that it must use WebRequest function.
-
Parse the fetched CSV data into a format that can be used within the MQL5 script.
-
Use the parsed data to create an indicator in MetaTrader 5.
You can follow this exemple to fetch data (or write your own):
///////////////////////
#include <Web/WebRequest.mqh> #include <Files\File.mqh> #include <Arrays\ArrayObj.mqh> void OnStart() { // URL to the CSV file string url = "https://docs.google.com/spreadsheets/FILE"; // Make a GET request to the URL char result[]; int res = WebRequest("GET", url, NULL, 0, NULL, result); // If the request was successful, res will be the number of bytes received if (res != -1) { // Convert the result to a string string data; ArrayResize(data, ArraySize(result)); for(int i = 0; i < ArraySize(result); i++) { data[i] = CharToStr(result[i]); } // Split the string into lines (assuming each line is a new data entry) string lines[]; int numLines = StringSplit(data, '\n', lines); // Parse each line into a separate array (assuming values are comma-separated) for(int i = 0; i < numLines; i++) { string values[]; int numValues = StringSplit(lines[i], ',', values); // Now you have an array of values for each line in the CSV data // You can process these values as needed for your indicator } } else { Print("WebRequest failed with error code: ", GetLastError()); } } //////////////////////
Looking forward to working with you.