In order to send an alert from TradingView to MetaTrader 4/5 you need:
You can join using two ways:
Find Profit Robots Bot in the list of contacts on our server a send any message to it.
Type M to our Discord Bot and wait for the bot reply. Then type E.
The bot will generate you an extenal executer key. Use this key to send messages from your trading platform just like other Discord/Telegram keys. But these messages will not be posted anywhere. They will be stored in the bot database. You can get these messages from bot database using the same key in MetaTrader or FXTS2.
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.
Select + Remote executer key
The bot will generate you an external executer key. Use this key to send messages from your trading platform just like other Discord/Telegram keys. But these messages will not be posted anywhere. They will be stored in the bot database. You can get these messages from bot database using the same key in MetaTrader or FXTS2.
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.