
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You just saved my life man/girl
Do you mind sharing how you went about it beacause it doesnt work for me
You can use %250A for break new line in message was sent.
It works thank you.
Why %250a and not %0a like using the api outside MT4 ?
You can use %250A for break new line in message was sent.
Besides, I confirmed that when sending request via Postman, the \n in the message body works fine without the need of specifying parse_mode.
LAST MESSAGE WORK GREAT THANK´S A LOT
MQL5 CODE
//--------SEND BUY TO TELEGRAM-------
char data[];
char res[];
string resHeaders;
double current_bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
//string msg = "BUY SIGNAL GENERATED ON CHART "+_Symbol ;
string msg = "BUY "+_Symbol+" @"+current_bid+"%0A"+" Stop Loss at:"+NivelSLCompra(StopLoss)+"%0A"+" Take Profit 1 at: "+NivelTPCompra(TakeProfit);
//https://api.telegram.org/bot{HTTP_API_TOKEN}/sendmessage?chat_id={CHAT_ID}&text={MESSAGE_TEXT}
const string url = TG_API_URL+"/bot"+botTkn+"/sendmessage?chat_id="+chatID+
"&text="+msg;
int send_res = WebRequest("POST",url,"",10000,data,res,resHeaders);
if (send_res == 200){
Print("TG MSG SENT SUCCESSFULLY");
}
else if (send_res == -1){
if (GetLastError()==4014){
Print("PLEASE ADD THE ",TG_API_URL," TO THE TERMINAL");
}
Print("UNABLE TO SEND THE TG MSG");
}
else if (send_res != 200){
Print("UNEXPECTED RESPONSE ",send_res," ERR CODE = ",GetLastError());
}
work fine