Hi master MQL coders,
I have been trying my hand on using Telegram to get updates about my expert advisors. Lately I created a Telegram channel where I want to send entries taken by an expert advisor. However, I encounter error 1007. This is the first time I encountered this error, and I could not find helpful resources here or elsewhere online. Are you familiar with this error?
By the way, here is a snippet of my code:
I was able to get the desired text format when I use the SendNotification function. However, the Telegram message is not sent because Webrequest returns 1007 error.
By the way, here is my desired text output:
[BUY/SELL] [symbol] @ [entryprice]
TP1: [TP1]
TP2: [TP2]
TP3: [TP3]
SL: [SL]
the string "sms" needs to be URL encoded before sending to telegram. someone made a version for MT4 here https://www.mql5.com/en/forum/149688
adjusted version below for MQL5:
string urlencode(string s) { int len = StringLen(s); string encoded; uchar chars[]; StringToCharArray(s,chars); for (int i = 0; i<len ;i++) { if (('a' <= chars[i] && chars[i] <= 'z') || ('A' <= chars[i] && chars[i] <= 'Z') || ('0' <= chars[i] && chars[i] <= '9')) { encoded = encoded + CharToString(chars[i]); } else { encoded = encoded + StringFormat("%%%02X", chars[i]); } } return encoded; }
- 2014.02.16
- Ex Ovo Omnia
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi master MQL coders,
I have been trying my hand on using Telegram to get updates about my expert advisors. Lately I created a Telegram channel where I want to send entries taken by an expert advisor. However, I encounter error 1007. This is the first time I encountered this error, and I could not find helpful resources here or elsewhere online. Are you familiar with this error?
By the way, here is a snippet of my code:
I was able to get the desired text format when I use the SendNotification function. However, the Telegram message is not sent because Webrequest returns 1007 error.
By the way, here is my desired text output:
[BUY/SELL] [symbol] @ [entryprice]
TP1: [TP1]
TP2: [TP2]
TP3: [TP3]
SL: [SL]