// Define the URL of the website string websiteUrl = "https://forexclientsentiment.com/forex-sentiment"; // Replace with the correct URL // Define variables to store the sentiment values double bearishSentiment; double bullishSentiment; // Create a function to make an HTTP GET request int HttpGetRequest(string url, string &out) { int timeout = 5; // Set your desired timeout in seconds int request = WebRequest("GET", url, "", NULL, timeout * 1000); if (request == -1) { Print("Error in WebRequest. Error code: ", GetLastError()); return (-1); } int res = -1; int content_length = 0; while (!IsStopped(request)) { res = WebRequest("GET", url, "", NULL, timeout * 1000); if (res >= 0) { content_length = StringLen(out); if (content_length > 0) { break; } } } return res; } // Function to parse sentiment values from the website content bool ParseSentimentValues(string content, double &bearish, double &bullish) { int bearishStart = StringFind(content, "Bearish:", 0); int bullishStart = StringFind(content, "Bullish:", bearishStart); if (bearishStart == -1 || bullishStart == -1) { return false; // Sentiment data not found } bearish = StringToDouble(StringSubstr(content, bearishStart + 8, 4)); bullish = StringToDouble(StringSubstr(content, bullishStart + 8, 4)); return true; } // Entry point of the script int start() { string response; int result = HttpGetRequest(websiteUrl, response); if (result >= 0) { // Successful request, parse the sentiment values if (ParseSentimentValues(response, bearishSentiment, bullishSentiment)) { Print("Bearish Sentiment: ", bearishSentiment); Print("Bullish Sentiment: ", bullishSentiment); // Add your logic to generate buy/sell signals based on the sentiment values // For example, if bullish sentiment is higher than bearish, consider a buy signal. // If bearish sentiment is higher, consider a sell signal. } else { Print("Sentiment data not found on the website."); } } else { // Error occurred Print("Failed to fetch data from the website."); } return (0); }