Trading libraries for MetaTrader 5

Telegram Connector MT5

telegram-connector-mt5-logo-200x200-9735
100.00 USD

Free updates are included

We Accept:

Limited offer! Save up to 10%

Coupon Code: START10OFF

We guarantee that all our
products are 100% authentic

Information

Libraries
MetaTrader 5
20
Andrii Ivanov
23 January 2020
1

Overview

About MT5 to Telegram

Telegram Connector is a FREE library that joins any EAs with telegram's channels, groups or private chat. Both ways: from MT5 to Telegram and back. 

Key features

How to use library? 

1. Add the following code to import funcs:
struct TelegramMessage
{
   long MessageId;
   string Text;
   datetime TimestampGMT;
};

#import "Telegram Connector MT5.ex5"
   bool TelegramInit(const string botToken, const long channelId);
   bool TelegramInit(const string botToken, const string channelName);
   void TelegramGetUpdates(TelegramMessage& messages[]);
   string BuildReplyMarkup(const string keyboard, const bool resize = false, const bool  false);
   string BuildReplyKeyboardHide();
   bool TelegramSendText(const string text, const bool htmlMode = false, const string replyMarkup = NULL);
   bool TelegramSendPhoto(const string path, const string title, const bool useCommonFlag = false, const int timeout = 10000);
#import

2. Allow WebRequest for https://api.telegram.org/ (read more https://www.metatrader4.com/en/trading-platform/help/setup/setup_experts)

3. Using @BotFather (https://core.telegram.org/bots) find bot token and populate the following variables: 

string botToken = "XXXXXXXXX:XXXXXXXXXXXXXXXXX_XXXXXXXX-X-XXXXXX";
string channelName = "TelegramChannelName"; // Channel or Group name
4. Init library and send text with emoji 
int OnInit()
{
   if (!TelegramInit(botToken, channelName))
   {
      return INIT_FAILED;
   }

   TelegramSendText("========\n" + MQLInfoString(MQL_PROGRAM_NAME) + " has joined \xF44D" + "\n========");

   EventSetTimer(3); // to check messages every 3 seconds

   return(INIT_SUCCEEDED);
}

5. Create screenshot and send to Telegram

   string filename = "tmp.png";
   int width = (int)ChartGetInteger(0, CHART_WIDTH_IN_PIXELS);
   int height = (int)ChartGetInteger(0, CHART_HEIGHT_IN_PIXELS);
   ChartScreenShot(0, filename, width, height);
   
   string title = _Symbol + " " + EnumToString((ENUM_TIMEFRAMES)_Period);
   StringReplace(title, "PERIOD_", "");
   
   TelegramSendPhoto(filename, title);
   
   FileDelete(filename);

6. Receive messages from Telegram

void OnTimer()
{
   TelegramMessage messages[];
   TelegramGetUpdates(messages);
   
   for (int i = 0; i < ArraySize(messages); i++)
   {
      Print(TimeToString(messages[i].TimestampGMT, TIME_DATE | TIME_MINUTES | TIME_SECONDS), " ", messages[i].Text);
   }
}

7. Send custom reply keyboard markup to Telegram (https://core.telegram.org/bots/api#replykeyboardmarkup)

Warning: only private chats support reply keyboard markup

#define KEYBOARD1    "[[\"\xF5A8 Reporting\"],[\"\xF4B9 Trading\"],[\"\xF4C8 Charts\"]]"

...

TelegramSendText("Choose your option", true, BuildReplyMarkup(KEYBOARD1));

8. Handle user's choice

void OnTimer()
{
   TelegramMessage messages[];
   TelegramGetUpdates(messages);
   
   for (int i = 0; i < ArraySize(messages); i++)
   {
      if (StringFind(messages[i].Text, " Reporting") >= 0)
      {
         TelegramSendText("AccountEquity: " + DoubleToString(AccountInfoDouble(ACCOUNT_EQUITY), 2), false, BuildReplyKeyboardHide());
      }
   }
}


Troubleshooting

1. Cannot call 'Telegram Connector.ex5::TelegramInit', 'Telegram Connector.ex5' is not loaded

Solution: Double check where Terminal has stored "Telegram Connector.ex5" file. For some reasons it can be "\MQL5\Scripts\Market\". Just move file into "\MQL5\Libraries\" folder.

7 DAY MONEY BACK GUARANTEE

If for any reason you do not like the purchased program, you can request a refund within 7 days from the date of purchase. You can also make an exchange for any other product at an equal cost or by paying the difference.

Simply send a request for refund or exchange with your order number by email: [email protected].

Refund requests received more than 7 days after purchase will be rejected.

Email Us Now! Support is available 24/7
by Email: [email protected]

Do You Need Help?
Click Here To Start Live Chat

Contact Us

Copyright © 2020 EA-Trade.pro. All rights reserved. Terms and conditions | Privacy policy     We speak your language EN|CN|DE|ES|RU

RISK WARNING: ea-trade.pro is a software reseller, we do not offer investment advice or execute trades. The software we provide is a tool where the settings are input by the end user to design their own trading strategy. Trading forex and CFDs carry a high degree of risk to your capital and it is possible to lose your entire deposit. Only speculate with money you can afford to lose. As with any trading, you should not engage in it unless you understand the nature of the transaction you are entering, and the true extent of your exposure to the risk of loss. These products may not be suitable for all investors, therefore if you do not fully understand the risks involved, please seek independent advice.

Search