Hi; I wrote this indicator that initializes and loads successfully (see image below).
I get no execution error either except I get a fetching error (but no error code)
The code I use compiles without errors as well:
//+------------------------------------------------------------------+//| BBDT-FX-News.mq4 |//| Copyright 2024, MetaQuotes Ltd. |//| https://www.mql5.com |//+------------------------------------------------------------------+#property indicator_separate_window#property indicator_buffers1#property indicator_color1 White
string website_data = "Loading..."; // Default data to showintOnInit() {
// Periodically call the function to update dataEventSetTimer(60); // Update every 60 secondsreturn(INIT_SUCCEEDED);
}
int deinit()
{
//----ObjectsDeleteAll();
Comment("");
//----return(0);
}
voidOnTimer() {
// Fetch data from the websitestring url = "https://www.thisisthewebsite.com/";
string cookie=NULL,headers;
char post[],result[];
ResetLastError();
int timeout=5000;
int res = WebRequest("GET",url,cookie,NULL,timeout,post,0,result,headers);
if(res == -1) {
website_data = "Error fetching data";
} else {
website_data = CharArrayToString(result);
}
}
intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[]) {
// Display the website data as text on the chartComment("Website Data: ", website_data);
// You can call the OnTimer function to update the data regularly// OnTimer();return(rates_total);
}
Any suggestions why I am getting a fetching error?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi; I wrote this indicator that initializes and loads successfully (see image below).
I get no execution error either except I get a fetching error (but no error code)
The code I use compiles without errors as well:
Any suggestions why I am getting a fetching error?
Much appreciate your feedback.
Thank you