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

 


We are trying to use theTelegram_Bot_EA scriptto send a chart screen on request. We have slightly modified it in terms of selecting templates and other tools. But I think it is not essential. Let's say there are two users.

- The first one starts the bot, selects a tool (let's say RI), selects a TF - 5min, pauses....

- the second starts the bot, selects the instrument (BR), selects the TF - 30min, selects pattern "#1". - gets the correct screen.

- the first one continues and selects pattern "#2" and gets.... the picture that the second one got.


That is, the moment the first one paused, the bot somehow rebuilt itself on the data it received from the second one, and then used it when the first one finished sending the request. It turns out that the variables where the tool, TF, and pattern are stored are global in a way, and that's why they were replaced.

How can this problem be solved?

The example on the screen below. An RTS instrument was ordered, 5m. I was delayed before selecting a template, while the second user was requesting his picture. Then I continued to select the template and got BR, H1 instead of RTS

The problem is as follows.



How can this problem be solved?

 
StarleyNSK:

That is, at the moment when the first one paused, the bot somehow rebuilt itself on the data received from the second one, and then used it when the first one finished sending the request. It turns out that the variables where the tool, TF, and template are stored are global in some sense, and that's why they were replaced.

How can this problem be solved?

Analyse the i-di of the user who is requesting the data, and store everything with a binding to that i-di.

 
Hello. Is there any possibility to make the bot able to view all messages in the chat and quote a certain message?
 
Yevhenii Levchenko:

Sometimes, when trying to send a screenshot of a graph, it says: "Error: Unknown error 5020" - the file does not exist. Although it is present in the Files folder. This happens sometimes. Sometimes it publishes everything in a row (I make more than 3 seconds delay between sending messages). The algorithm itself looks as follows: the bot opens a chart, moves the chart to the rightmost position, creates arrows (price levels), takes a screenshot, sends it (after sending a delay of 3 seconds just ... without it for some reason does not want to send it), deletes the arrows and after checking for the presence of the file deletes it. Or does not delete it. If the bot gives error 5020 when sending, the FileIsExist function returns nonsense. I tried to set delays after file creation, but it didn't help much. I send to an open channel. The extension is .gif.

How bad is this solution (sending screenshots like this)? The code is probably far from ideal, but why doesn't it want to send screenshots? Or rather, sometimes it sends them normally, and sometimes it doesn't want to send them at all. Internet seems to be normal...

Instead of delay it is more beautiful to use the function of checking for the presence of a file, but not just the presence of a file in the catalogue, but the presence of its length. There are situations when a file appears with zero length, while the process of writing to it is not completed, and only after the completion of writing the length is fixed.

It can be tracked in OnTime.

 
Yuriy Zaytsev:

Instead of delay, it is more beautiful to use the function of checking for the presence of a file, but not just the presence of a file in the directory, but its length. There are situations when a file appears with zero length, while the process of writing to it is not completed, and only after the completion of writing the length is fixed.

It can be tracked in OnTime.

Yes, this is a more complete solution. Thanks for the advice!

 
Indra Lukmana:

Hi all,


I dunno if this question have been asked previously, 

I tried this modul with EA format and it works wonderfully, however when i tries this modul with indicator format, it shows an error as below:

2020.08.26 10:25:37.839 inLuk_TelegramBot EURUSD,H1: Error: URL does not allowed for WebRequest


any suggestion ? or this modul can't be work on indicator? 

thanks.

Are you using windows 7? 

I got webrequest problem with windows 7 

 
firecard:
I have this error:

'SendPhoto' - no one of the overloads can be applied to the function call Telegram_Bot_EA.mq5 117 24


When compiling telegram_bot MT5

On page 4 you find the solution  
 

Hello traders !

I have a question,

i tried the Telegram_Bot_EA for Mt4 and Mt5 .... 

Can anybody tell me why the bot don´t send screenshot on weekend on Mt4, file is generated in file folder and also on telegram you see (send photo on top) but no screenshot is coming ?

On mt5 the screenshot is coming in a few seconds .

best regards 

 
Audiamant:

Hello traders !

I have a question,

i tried the Telegram_Bot_EA for Mt4 and Mt5 .... 

Can anybody tell me why the bot don´t send screenshot on weekend on Mt4, file is generated in file folder and also on telegram you see (send photo on top) but no screenshot is coming ?

On mt5 the screenshot is coming in a few seconds .

best regards 

When u communicate mt4 to Telegram n other way does the EA communicate,  check logs
 
Jefferson Metha:
When u communicate mt4 to Telegram n other way does the EA communicate,  check logs

Yees the EA communicate the only problem it dont send screenshot on weekend ? (mt4)

in the log file i see only EA loaded successfully


Very interesting because from Monday to Friday it works  .

Is anyone having the same problem ?