How to make Communication between telegram and expert advisor

Опубликовано: 06 Май 2026
на канале: EcoEngineering
4,073
112

Code:




//+------------------------------------------------------------------+
//| Telegram_Test.mq4 |
//| Copyright 2021, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{

string cokkie;
string referr;
int TimeOut=2000;
char data[];
char result[];
string header;

string token="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
string chat_ID="XXXXXXXXXXXXXXXX";

string Massage="The number of open orders is equal to: "+ IntegerToString(OrdersTotal(),5);

string BaseURL="https://api.telegram.org/";

string FinalURL="https://api.telegram.org/"+"/bot"+ token+"/sendMessage?chat_id="+chat_ID+"&text="+Massage;


WebRequest("GET",FinalURL,cokkie,referr,TimeOut,data,0,result,header);


}

This video is the first part of connecting Telegram and expert advisor series. (Sending and receiving data between telegram and expert advisor)