Telegram 4 MQL - A .NET library for exchanging messages between Metatrader and Telegram

To add comments, please log in or register


Telegram 4 MQL was made to make the life of an automtic trader a bit more convenient or better to say it was made to spare nerves. Suitable questions while operating an autotrading systems are:

  • Was the order correctly executed?
  • Did an situation change an unusual way so that I need to interfere remotely?
  • ...

Then you may think about an solution that depends on high available services that you can easily base on and stay tuned to your automatic trading bots. That is where Telegram 4 MQL comes into the game.

Sample Screenshot:

Here is a screenshot that shows a sample workflow:

  • You have an active EA running that observerves some market data and sends a notification if a specific value was exceeded
  • As a reaction you want to place an order.
  • You get a confirmation that the order was successfully placed.


Sample Implementation:

The following code snippet shows how easy it is to use this library:

//| Import block for the Telegram 4 MQL functions                                    |
#import "Telegram4Mql.dll"
   string TelegramSendTextAsync(string apiKey,string chatId,string chatText);
   string TelegramSendText(string apiKey,string chatId,string chatText);
   string TelegramSendScreenAsync(string apiKey,string chatId,string caption="");
   string TelegramSendScreen(string apiKey,string chatId,string caption="");
   string TelegramGetUpdates(string apiKey,string validUsers,bool confirmUpdates);

// ...

//| Here is a code block with sample calls.                          |
//| For the complete documentation please visit                      |
//|                      |

void testTelegram4Mql()
   string apiKey="112141336:xxxxxxxxxxxxxxxxxxxx"; // Your API key
   string chatId="14xxxxxx"; // Chat ID or username

   /* The following functions will print '0' if everything goes just fine. */
   Print(TelegramSendTextAsync(apiKey,chatId,"test async"));
   Print(TelegramSendScreen(apiKey,chatId,"test photo"));
   Print(TelegramSendScreenAsync(apiKey,chatId,"test async photo"));

    The following function will print '0' if everything goes just fine
    followed by the amount of updates received in total
    and the commands from authorized users.

Further Information:

Because documentation affort may increase over time the documentation is considered to be placed outside of this website. You can find

  • Downloads
  • Examples
  • Issue information
  • ...


Related Work:

Another very good work, implemeted in native MQL in contrast to this work, can be found here: - How to create Telegram Bots in MQL5. Have a look at it also, because this solution meets other requirements than Telegram 4 MQL.

Hamed Nikseresht
Hamed Nikseresht  

I made a code that use Telegram4Mql.dll

This code work well.

But today i received this Error and my EA stop send messages !!!!

Error is : Object reference not set to an instance of an object.

Please let me know more why this error occurred.

Marcos Martinelli
Marcos Martinelli  
Someone got the code working successfully?
To add comments, please log in or register