I have created an indicator signal and would like to send the signal to telegram channel, i have create the telegram channel with the telegram BOT (API KEY).
I tried to enable telegram on mt4 but it seems its for EA not for push notification.
Any one has any advise?
3
Answers
In MT4, I would make a get http request to some REST API. Your MT4 code I would call something like the following
http://XYZ.ABC/AccountNumber/Symbol/Signal
Then in what ever the endpoint is, I would read that URL and split it apart. After spitting it apart then I would take that data and Post it to telegram by what ever method you want to use for talking to telegram with your API key to hit your channel you have.
How to send alerts from MetaTrader 4/5 to Telegram
In order to send an alert from MetaTrader 4/5 to Telegram you need:
Get Telegram key from ProfitRobots bot
Install Notifications library to your MetaTrader 4/5
Modify your indicator/expert
How to get a secret key for the Telegram
Step 1. Find Profit Robots Bot
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).
Step 2. Start a conversation.
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).
Generate a new key or delete it
You can regenerate any key. In order to do that you need:
Step 1. Push the "Manage keys" button
Step 2. Select a key you want to regenerate by clicking on its index or typing "/number"
Step 3. Push "Regenerate"
The bot will generate a new key.
To delete key you need to follow the same steps but use the "Delete" button instead of "Regenerate". But only channel/group keys could be deleted.
Creating a channel or group key.
You can send messages to Telegram channels/groups. Each channel or group will have its own secret key. Follow the next steps to get that key.
Step 1. Push the "+ Channel key" button.
The bot will send you a brief instruction and secret code to verify the channel or group.
Step 2. Add Profit Robots Bot to your channel/group or char as an administrator
Click on your channel/group name.
Telegram will show you a window with the 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. The "write key" allows you to post messages into the channel. The "read key" allows you to get keys posted into this channel from MetaTrader 4/5 and FXTS2.
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.
How to install the Notification library into your MetaTrader 4/5
Run ProfitRobots installer. It’ll show you all MetaTrader terminals installed on your PC.
Select the one you need, select the Notifications options and click "Install".
Modify the code of indicator/expert to support a new type of alerts
This manual is for developers. If you are not a developer then consider hiring one. You can find the developer on Upwork or use a free development service like FXCodeBase.
You need to have an option for the key received above.
Or you can hardcode it as well.
Import of the Notifications library. You can do that using this piece of code
That’s it. Just do not forget to allow DLL imports in the indicator/expert parameters.
AdvancedNotificationsLib.dll DOWNLOAD
https://profitrobots.com/Installer/setup.exe
You can try MetaApi https://metaapi.cloud cloud service which provides REST API and WebSocket API access to both MetaTrader 4 and MetaTrader 5 accounts.
MetaApi service provides an SDK which exposes so called real-time streaming API. Using this API you can listen to position or order update events on your MT account in real-time and react to them by executing a custom code (in your case it will be the code to submit the signals to a Telegram channel).
This way you can code your app entirely in high-level language like javascript, python or Java where Telegram integrations are available and easy to use.
SDKs: https://metaapi.cloud/sdks (javascript, python and Java SDKs are provided as per Mar 2022)