To send alerts from Telegram to MetaTrader 4/5 you will need:
Use this link or just search for Profit Robots Bot. There are some fake bots, so make sure that you are using the real one (like shown on the screenshot).
Start a conversation with Profit Robots Bot. It should reply to you and give you a key. This is your personal key. All messages for that key will be forwarded by the bot into your private dialog with the bot.
You can always use the Show my keys buttons to get all your keys (you can have more than one key).
Each channel or group will have its own secret key. Follow the next steps to get that key.
The bot will send you a brief instruction and secret code to verify the channel or group.
Click on your channel/group name.
Telegram will show you a window with information about your channel. Push 3 dots to get the menu and select Manage group or Manage channel.
In the Edit group window click on Administrators.
Push the Add administrator button.
Search for @@profit_robots_bot and select the Profit Robots Bot.
Click OK.
For a group, you may unselect all permissions and click the Save button. Close all windows.
The bot will automatically detect addition to the new group and will give you the key.
For a channel leave the Post messages permission for the bot.
Close all windows and post the verification code into your channel from Step 1. Use the read-key code.
The bot should detect the verification code and give you the key for that channel. You can delete the verification code from your channel now.
You can get alerts by using AdvancedNotificationsLib. Do import that library by putting the next piece of code:
enum ServerType
{
SelfHosted = 1, // Self-hosted
WSS = 4, // ProfitRobots.com (secured)
};
#define LISTENER_STATUS_DISCONNECTED 0
#define LISTENER_STATUS_CONNECTING 1
#define LISTENER_STATUS_CONNECTED 2
#import AdvancedNotificationsLib.dll
void AdvancedAlert(string key, string text, string instrument, string timeframe);
bool StartListener(string key, int serverType);
bool StopListener();
int ListenerStatus();
string GetNextMessage();
#import
This library load alerts asynchronously. It cal load alerts for 1 key only.
Call StartListener in the initialization of an expert to start loading alerts for the specified key.
Before getting an alert check for the status by calling ListenerStatus. If the status is LISTENER_STATUS_DISCONNECTED then connect again.
Call the GetNextMessage in a loop. Each call will return a new alert. An empty string will be returned when there will be no more alerts.
Call StopListener in the deinitialization of an expert.
bool connect_sent = false;
void DoConnect()
{
StartListener(You read key, WSS);
connect_sent = true;
}
int OnInit()
{
if (!IsDllsAllowed())
{
Alert(Error: Dll calls must be allowed!);
return INIT_FAILED;
}
EventSetTimer(1);
if (ListenerStatus() == LISTENER_STATUS_DISCONNECTED)
{
DoConnect();
}
return INIT_SUCCEEDED;
}
void OnDeinit(const int reason)
{
EventKillTimer();
StopListener();
connect_sent = false;
}
void OnTimer()
{
if (!connect_sent && ListenerStatus() == LISTENER_STATUS_DISCONNECTED)
{
DoConnect();
return;
}
string command = GetNextMessage();
while (command != )
{
ParseAndExecuteCommand(command);
command = GetNextMessage();
}
}
You can use order_executer if you the one who sends these alerts into the channel. Just send alerts in this format. order_executer can parse this syntax and execute orders without any coding.