Telegram CPP/Mt4 how to listen to messages in a invite-only channel, application has to be distributed

947 views Asked by At

I'm working on an MT4 expert advisor and I just can not solve my scenario, maybe you guys can help me out.

Scenario
A user installs the EA (expert advisor) on MT4, there is a invite-only Telegram group which posts messages. The user and/or the bot are in that channel.


What I would like to achieve
I would like my application to be able to read the messages in that group, it can be bot-based aswell as user-based but it must be able to be distributed!


What I've tried

  • Make a bot and add it to the group, I can query messages with this but I can't distribute it since the bot key has to be kept private (says the Telegram BotFather).
  • Try to use TDLib but I don't think MQL4 supports it, and that's a little too much for what I would like to achieve.

I can for example also make my own API which is connected the bot in the group, and forwards those messages, so I don't have to distribute the bot key but just the URL with a key. I'm not convinced of this solution, though.


The code
I've included the Telegram.mqh Library in my MQL4 code.

#property strict

#include <Telegram.mqh>

int OnInit()
{
    // How to connect to the group and listen to messages?
    return (INIT_SUCCEEDED);
}

void OnDeinit(const int reason)
{
}

void OnTick()
{
}

I'm completely stuck on how to approach this problem, please help me out.

1

There are 1 answers

0
Andy Thompson On

You could start with telethon in python script. If you were using mt5 you could trade out of the same script, but for mt4 you would have to use an ea and use a csv intermediate file