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

To add comments, please log in or register
Deyan Ivanov
362
Deyan Ivanov  
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

Dave_mql
8
Dave_mql  

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
Danrlei Hornke
243
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?

//+------------------------------------------------------------------+
//|                                        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));
  }

Marco vd Heijden
Moderator
13037
Marco vd Heijden  
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.

Deyan Ivanov
362
Deyan Ivanov  

Hello,


I am experiencing a small issue with the Telegram Bot EA mt5 - I am able to add additional template in the settings BUT when I test it from the Telegram it is loading only Default template. 

Any recommendations or a hand for help?


Thanks in advance!

Asadollah Ramezani
13
Asadollah Ramezani  

Hi,

I tried to use the EA code in a Costume indicator but I receive "URL does not allowed for WebRequest " error, Could you please explain how to solve this problem and send alerts and screenshots from a Costume indicator to the Telegram?

Thanks.

Jefferson Metha
4133
Jefferson Metha  
Asadollah Ramezani:

Hi,

I tried to use the EA code in a Costume indicator but I receive "URL does not allowed for WebRequest " error, Could you please explain how to solve this problem and send alerts and screenshots from a Costume indicator to the Telegram?

Thanks.

Open metatrader 
Tools 
Options 
Expert Advisor 

Enable webrequest 
Enter

Https://api.elegram.org
Lucas BC
13
Lucas BC  
is it possible to have the bot send a picture of my graph screen every 15 minutes?
Asadollah Ramezani
13
Asadollah Ramezani  
Jefferson Metha:
Open metatrader 
Tools 
Options 
Expert Advisor 

Enable webrequest 
Enter

Https://api.elegram.org
Thank you for reply. I'v already done that but it still doesn't work! there is no problem when the code is implemented with an EA  but when i use it in a Costume indi the above mentioned error occur. it seem Standard mql function Webrequest do not work in indicators. please have a look on the attached file.
Files:
Jefferson Metha
4133
Jefferson Metha  
Asadollah Ramezani:
Thank you for reply. I'v already done that but it still doesn't work! there is no problem when the code is implemented with an EA  but when i use it in a Costume indi the above mentioned error occur. it seem Standard mql function Webrequest do not work in indicators. please have a look on the attached file.
The Lib dnt work with indicators only EA, im not sure about Scripts. 

Reread Article its stated
To add comments, please log in or register