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

 
agsapri:

i change from for(int i=0;i<=1;i++) to for(int i=0;i>=1;i--) on signal ea,

now i got no signal from telegram, can help/guide me  ;(

are need to change in

include <Telegram.mqh>

#include <Arrays\List.mqh>

#include <Arrays\ArrayString.mqh>

#include <Common.mqh>

#include <Jason.mqh> too?

i>=1;i--?

 
               if(index==-1)
                 {
                  m_chats.Add(new CCustomChat);
                  CCustomChat *chat=m_chats.GetLastNode();
                  chat.m_id=msg.chat_id;
                  chat.m_time=TimeLocal();
                  chat.m_state=0;
                  chat.m_new_one.message_text=msg.message_text;
                  chat.m_new_one.done=false;
                 }
               //--- update chat message
               else
                 {
                  CCustomChat *chat=m_chats.GetNodeAtIndex(index);
                  chat.m_time=TimeLocal();
                  chat.m_new_one.message_text=msg.message_text;
                  chat.m_new_one.done=false;
                 }

this is the code from the int GetUpdates() procedure

Yes, the msg structure is filled perfectly, but the only thing copied from it to the pointer to the chat room is

                  chat.m_time=TimeLocal();
                  chat.m_new_one.message_text=msg.message_text;
                  chat.m_new_one.done=false;
 

If there is not enough information, you can add it this way:

chat.m_new_one=msg;
 
Andrey Voytenko:

If there is not enough information, you can add it this way:

Error pops up in CCustomMessage msg = {0}; and when sending a message to the channel, Error: HTTP request failed. What could be the problem?

 
Nikita Avramenko:

The error pops up in CCustomMessage msg = {0};

Please update the Telegram.mqh file. It is posted two posts above.

 
Andrey Voytenko:

Please update the Telegram.mqh file. It is posted two posts above.

Thanks, I didn't pay attention to it.

Can the bot read information from the channel it is in?

 
Andrey Voytenko:

Thank you for the message. However, your corrected version works only with Latin characters.

Logically, you should convert the string into a UTF-8 encoded array and insert it as caption in the request body.

My variant is in the attachment.

I have added this file to the article.

 

Hello everyone.

I am not strong in programming, but still decided to make a telegram bot for my channel.

Can you tell me how to implement that the bot would send data about open trades to mt4?

 
Hmm, something doesn't work at all)) it gives compilation errors
 
Your post on how to use Telegram in MQL5 is incredible. I will study and add to my EAs, so it is easy to know how they are working.
You are to be congratulated.