Discussion of article "How to create bots for Telegram in MQL5" - page 18

 
Thế Nguyễn:

@Deyan Ivanov

I have this problems too, this is my code fixed for MT4. Edit file "Telegram_Bot_EA.mq4" replace method "int SendScreenShot(...)"

Thank you very much!

It is better now

 

i try to use with a channel even if got new message the result is always empty string,how can i solved?

thanks

Files:
Cattura.PNG  54 kb
 

opa Very interesting friend your code.


I'm having some problems with the latest Code, I've tried everything if you can help me.


It seems that Mql5 does not recognize the Bot on the Channel or telegram chat. Since I set the tokem correctly and the chat name is also correct. I also placed the chats as public. I don't know what might be causing the error. I created a Base Code in OnTimer just to test the sending. I may have been wrong there, who knows?

//+------------------------------------------------------------------+
//|                                        Telegram_Signal_EA_v1.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//|   inclusão                                                       |
//+------------------------------------------------------------------+
#include <Telegram.mqh>

//--- Parâmetros de entrada
input string InpChannelName = "  "; //Nome do Canal
input string InpToken = "  "; //Token

//--- Variáveis globais
CCustomBot bot;
int macd_handle;
datetime time_signal = 0;
//+------------------------------------------------------------------+
//| Função de inicialização do Expert                                |
//+------------------------------------------------------------------+
int OnInit()
 {
   EventSetTimer(5);
//--- configuração token
   bot.Token(InpToken);


   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//|                                                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   EventKillTimer();

  }
//+------------------------------------------------------------------+
//| Função tick do Expert                                            |
//+------------------------------------------------------------------+
void OnTimer()
  { 
      string msg =_Symbol;
      
      int res = bot.SendMessage(InpChannelName, msg);
      if(res != 0)
         Print("Error: ", GetErrorDescription(res));
  }

 
Danrlei Hornke:

opa Very interesting friend your code.


I'm having some problems with the latest Code, I've tried everything if you can help me.


It seems that Mql5 does not recognize the Bot on the Channel or telegram chat. Since I set the tokem correctly and the chat name is also correct. I also placed the chats as public. I don't know what might be causing the error. I created a Base Code in OnTimer just to test the sending. I may have been wrong there, who knows?

No you made a mistake and the bot is not a member (administrator) of the chat.

Nothing to do with MQL5 and it is correct in telling you the exact error time and time again.

 

Good day to all!

I for some reason yesterday suddenly stopped working translator to telegram channel, what can be the matter, before yesterday everything worked, mt4 is on the server, which is located in the Netherlands, what can be the matter?

 
Galina Finogeeva:

Good day to you all!

I for some reason yesterday suddenly stopped working translator to telegram channel, what can be the matter, before yesterday everything worked, mt4 is on the server, which is located in the Netherlands, what can be the matter?

Today came:

Please note that the Bot API only accepts incoming TLS 1.2 connections. Kindly update your bot if it was using the outdated TLS 1.0 or TLS 1.1 protocol.

 
Андрей Хатимлянский:

It came today:

And where to change it: in telegram bot create a new one?

 
Galina Finogeeva:

And where to change it: in telegram bot create a new one?

In the programme that implements the bot. In your case, if the translator is from MT, it is an Expert Advisor (MQL4 or MQL5).

 
Andrey Khatimlianskii:

In the programme that implements the bot. In your case, if the translator is from MT, it is an Expert Advisor (MQL4 or MQL5).

Can you help me change it? The programmer who wrote the translator for me is no longer in touch with me

 
Andrey Khatimlianskii:

In the programme that implements the bot. In your case, if the translator is from MT, it is an Expert Advisor (MQL4 or MQL5).

If you can help, please write in my new topic: https: //www.mql5.com/ru/forum/332273.