How to connect a websocket with MT5?

 

Trying to connect this websocketwss://iqoption.com/echo/websocket

Like the following:  

void OnStart()
  {
   string cookie=NULL,headers;
   char   post[],result[];
   string url="wss://iqoption.com/echo/websocket";
//--- To enable access to the server, 
//--- you should add URL "https://api.coindesk.com/v1/bpi/currentprice.json" 
//--- to the list of allowed URLs (Main Menu->Tools->Options, tab "Expert Advisors"): 
//--- Resetting the last error code 
   ResetLastError();
//--- Downloading JSON from coindesk 
   int res=WebRequest("GET",url,cookie,NULL,500,post,0,result,headers);
   ArrayPrint(result);
   ArrayPrint(post);   
  }
//+------------------------------------------------------------------+

But getting nothing in the output.

Please let me know what I am missing.

 
jaffer wilson:

Trying to connect this websocketwss://iqoption.com/echo/websocket

Like the following:  

But getting nothing in the output.

Please let me know what I am missing.

did you add url to the allowed url of meta trade?

Read This:

https://www.mql5.com/en/forum/318624

And This: https://www.mql5.com/en/articles/8196
Allow websocket URL starting with ws:// or wss://
Allow websocket URL starting with ws:// or wss://
  • 2019.07.25
  • www.mql5.com
Hello, Is not possible add a new url that start with ws:// or wss:// to use in SocketConnect...