Help with indicator telegram BOT

 

Good afternoon everyone, I'm having some difficulty in making a bot get the pre-alerts from an indicator to OB, and send them to the telegram what I did was based on Voytenko's documentation, This file here was written by Wemerson C. , I'm using it

#define READURL_BUFFER_SIZEX   100

#define HTTP_QUERY_STATUS_CODE  19



#import  "Wininet.dll"

   int InternetOpenW(string, int, string, string, int);

   int InternetConnectW(int, string, int, string, string, int, int, int); 

   int HttpOpenRequestW(int, string, string, int, string, int, string, int); 

   int InternetOpenUrlW(int, string, string, int, int, int);

   int InternetReadFile(int, uchar & arr[], int, int& OneInt[]);

   int InternetCloseHandle(int); 

   int HttpQueryInfoW(int ,int ,uchar &lpvBuffer[],int& lpdwBufferLength, int& lpdwIndex);

#import





void ReadUrl(string url, string& data)

{

int HttpOpen = InternetOpenW(" ", 0, " ", " ", 0); 

   int HttpConnect = InternetConnectW(HttpOpen, "", 80, "", "", 3, 0, 1); 

   int HttpRequest = InternetOpenUrlW(HttpOpen, url, NULL, 0, 0, 0);

   

   uchar cBuff[5];

   int cBuffLength=10;

   int cBuffIndex=0;

   int HttpQueryInfoW = HttpQueryInfoW(HttpRequest, HTTP_QUERY_STATUS_CODE, cBuff, cBuffLength, cBuffIndex);

   

   // HTTP Codes... Only the 1st character (4xx, 5xx, etc)

   int http_code = (int) CharArrayToString(cBuff, 0, WHOLE_ARRAY, CP_UTF8);   

   if( http_code==4 || http_code==5 ){ // 4XX || 5XX

      Print("HTTP Error: ", http_code, "XX");

      if (HttpRequest > 0) InternetCloseHandle(HttpRequest); 

      if (HttpConnect > 0) InternetCloseHandle(HttpConnect); 

      if (HttpOpen > 0) InternetCloseHandle(HttpOpen);  

      data="HTTP_ERROR";

   }else{

      int read[1];

      uchar  Buffer[];

      ArrayResize(Buffer, READURL_BUFFER_SIZEX + 1);

      data="";

      while (true)

      {

         InternetReadFile(HttpRequest, Buffer, READURL_BUFFER_SIZEX, read);

         string strThisRead = CharArrayToString(Buffer, 0, read[0], CP_UTF8);

         if (read[0] > 0)

            data = data + strThisRead;

         else

            break;

      }

   }

   

   if (HttpRequest > 0) InternetCloseHandle(HttpRequest); 

   if (HttpConnect > 0) InternetCloseHandle(HttpConnect); 

   if (HttpOpen > 0) InternetCloseHandle(HttpOpen);  

}

and I call this file inside my code as shown below, however, it returns me a bad request 4xx error, other codes I have as an example, only send inputs when they are done in MQL4, and not the pre-alert of an indicator and if it gave win or loss, can anyone help me in this regard? with an example or the path I should follow. I thank you all.

#include <Wininet.mqh>
#define telegramBaseURL   "https://api.telegram.org"

///https://tlgrm.ru/docs/bots/api почитать как что отправлять
input string inpToken="111111111:gdfgsdfgsdfgsSDASffasd f";//Token
input string inpChat_id ="-346546546546456456";
bool inpParsMode =true;

int OnInit()
  {
    string data;
    string url="https://api.telegram.org/bot" + inpToken + "/sendMessage?chat_id="+inpChat_id;
   
    if(inpParsMode){
      url = url + "&parse_mode=HTML";
    } 
   
    url = url + "&text= " + "<b>1114</b>";
    
    ReadUrl(url,data);

    return(INIT_SUCCEEDED);
  }

 
Download wininet dll and put to MQL libraries folder
Reason: