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

Andriy Voitenko  

Eugenio Bravetti:

It's ok?

ok. But if you are working with a private channel, use the Channel ID, not the Channel Name.

Eugenio Bravetti  
Andrey Voytenko:

ok. But if you are working with a private channel, use the Channel ID, not the Channel Name.

Hi Andrey

Thanks for your availability

only one question for you....

I have need to send from MQL programm a file or simple information to other MQL programms via internet....(the platforms are in different locations)

With Telegram it's possible for you?

Do you have any suggestions?

Many thanks


Andriy Voitenko  

Eugenio Bravetti:

With Telegram it's possible for you?

I dont know how to exchange files between Telegram Bots.

Eugenio Bravetti  
Andrey Voytenko:

I dont know how to exchange files between Telegram Bots.

Andrey, I confirm you that your code work well on MT4 but not on MT5

The error returned on MT5 are:

2018.06.15 15:12:10.961 Telegram_Signal_EA (EURUSD,M30) CCustomBot::PostRequest res = 1001

2018.06.15 15:12:10.961 Telegram_Signal_EA (EURUSD,M30) CCustomBot::PostRequest _LastError = 5203

2018.06.15 15:12:10.961 Telegram_Signal_EA (EURUSD,M30) Error: Unknown error 1001



Fernando Jose Velasco Borea  
Hello Andrey,

Thanks a lot for the code! It works great, I just have one brief question:

I made a string to keep my message based on various stuff, like add a specific emoji for buy and for sell alerts and so on, and I came up with the idea of sending a chart Screenshot with each alert, I made the code and I just got a problem, when I use my string variable onto the caption argument of SendPhoto, it returns a BadRequest error, I tesed sending a dummy screen using "Test" into the caption and it worked perfectly, then, I figured out another way to find the problem and I sent "Error is on the text" on the caption and it sent the Screenshot but I found the problem, it sends it to Telegram as "Error+is+on+the+text" So I think that this is caused by the formating of the text to be sent on the WebRequest function, but I don't have enough programming skills to figure out what has to be changed to be able to pass a nice format like:

⬆️New buy trade EURUSD⬆️
▶️Entry point: 1.23456◀️
🔵Take Profit: 1.24000🔵
🔴Stop Loss: 1.22000🔴

As I'm able to do with SendMessage. Would you help me to find out what has to be modified to handle those formats? 

Thanks a lot for the library again! 

Best regards, 
Nguyen Van Tuan  


When i have tested with this Library of  Andrey Voytenkoon MT5, It not work well so i have some more simple step. Any people hit same error can try to change like me:

1. Confirm add https://api.telegram.org to Allow WebRequest for listed URL

2. When you using chat_id (like "-1001301234105") instead @channel_name, you will hit some error with this code so i have change it

And now I confirm after i have do two things above, this library work well in MT5.

Thanks Andrey Voytenko again.

Is it possible to do the reverse?

Receive message on Telegram and then that sends the execution order to MT4 with my own trade size parameters?
   int res = bot.GetMe();
   Print("ERROR ",GetErrorDescription(GetLastError()));
   Print("Init res ",res);

I've use this basic code and tried many times last few days but keep getting this error: 

2018.12.22 23:50:50.792 EA (CADJPY,M30) ERROR HTTP request failed

2018.12.22 23:50:50.792 EA (CADJPY,M30) Init res 1001

I've tried to use `WebRequest` directly to `getMe` method but same issue. (sometime it return error 1003 as well)

However when I've built localhost API, the `WebRequest` can connect and does return api response successfully.

Please help...! Thank you in advance!