Error 4006 along with HTTP code 0 usually means that the request never actually gets established, often due to a network-level block (firewall, antivirus, or system settings) or SSL certificate issues. Since you’ve already added the URL correctly in the WebRequest() settings and confirmed that the bot and chat ID work via Postman, I’d suggest checking whether MetaTrader has permission to access the internet through port 443. You could also try sending a simpler request, without manually encoding parameters, to rule out any issues with your UrlEncode() function.
Lastly, take a look at the terminal logs (in the Journal or Experts tab), as they sometimes provide more detailed information about why the connection failed. If it still doesn't work, feel free to share a snippet of your code here so we can take a closer look and help you further.
Error 4006 along with HTTP code 0 usually means that the request never actually gets established, often due to a network-level block (firewall, antivirus, or system settings) or SSL certificate issues. Since you’ve already added the URL correctly in the WebRequest() settings and confirmed that the bot and chat ID work via Postman, I’d suggest checking whether MetaTrader has permission to access the internet through port 443. You could also try sending a simpler request, without manually encoding parameters, to rule out any issues with your UrlEncode() function.
Lastly, take a look at the terminal logs (in the Journal or Experts tab), as they sometimes provide more detailed information about why the connection failed. If it still doesn't work, feel free to share a snippet of your code here so we can take a closer look and help you furthth
thank you so much, I'll to fix it.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I'm trying to send a message to my Telegram bot using WebRequest() in MetaTrader 5, but it consistently fails with error code 4006.
Here's what I've already done:
Allowed WebRequest in MT5 under Tools > Options > Expert Advisors
Added the URL: https://api.telegram.org/
Restarted MT5 after setting
Verified my bot token and chat ID work with Postman (successfully sends messages)
Used StringToCharArray() and custom UrlEncode() to ensure proper data format
Sample request I'm using:
But still, I get:
Is there any recent change in MT5 that could block WebRequests to external APIs?
Or do I need to enable something more in Windows/Firewall settings?
Thanks in advance for any help! 🙏