i wana get GMT with WebRequest
can some one plz help
There are functions both for Gmt and the LocalGmtOffset , but regardless ,where is it failing ?
yes i know ..but i have (EA nwes filter) and this EA give me the news with GMT time
i wana this EA give me automaticly the news at time current of my mt4
the filter will probably expect a timezone , that is a massive headache to resolve so get the news in gmt and turn to server time on "download"
To turn the gmt times to Time of the server you will need to have an input that receives the offset or try to synchronize when the ea is live.
Meaning when a tick is received (so market is live + broker is alive) you can pull a snapshot of the TimeCurrent and the TimeGMT and find the offset .
Your problem will then be weekends . So , for a given week you must store the time difference discovered live , or , update it everytime a new bar forms .
the filter will probably expect a timezone , that is a massive headache to resolve so get the news in gmt and turn to server time on "download"
To turn the gmt times to Time of the server you will need to have an input that receives the offset or try to synchronize when the ea is live.
Meaning when a tick is received (so market is live + broker is alive) you can pull a snapshot of the TimeCurrent and the TimeGMT and find the offset .
Your problem will then be weekends . So , for a given week you must store the time difference discovered live , or , update it everytime a new bar forms .
thanks bro for u help ..i will try that .. and i hope will slove my prbleme
the filter will probably expect a timezone , that is a massive headache to resolve so get the news in gmt and turn to server time on "download"
To turn the gmt times to Time of the server you will need to have an input that receives the offset or try to synchronize when the ea is live.
Meaning when a tick is received (so market is live + broker is alive) you can pull a snapshot of the TimeCurrent and the TimeGMT and find the offset .
Your problem will then be weekends . So , for a given week you must store the time difference discovered live , or , update it everytime a new bar forms .
//+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { int time1 = StringFind (GMT_Time(),"GMT" ) ; string time2 = IntegerToString(time1); datetime time3 = StringToTime(time2 ); Comment (time2);// get GMT time } string GMT_Time() { string cookie=NULL; string strUrl; string headers; string ret; char post[] ,result[]; int res, timeout=5000; ResetLastError(); strUrl= "https://www.worldtimeserver.com/time-zones/utc/" ; res= WebRequest("GET",strUrl ,cookie,NULL,timeout,post,0,result,headers); if (res ==-1) { Alert("Web-Error: ",GetLastError()," (4060 ERR_FUNCTION_NOT_CONFIRMED/Url not allowed)" ); return(""); } ret = CharArrayToString(result,0,-1); return(ret); }
and i dont know why the result give me the local time
2023.06.29 04:48:51.484 2022.01.02 22:06:56 webrequest37 EURUSD,M1: HTTP/1.1 200 OK Cache-Control: private Date: Thu, 29 Jun 2023 02:49:13 GMT Content-Length: 298271 Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/10.0 Set-Cookie: ASP.NET_SessionId=fh1luoj5dkq4p3fmicueodmr; path=/; HttpOnly Set-Cookie: wtsID=1:wav6RHeqI0aMw9N1soHH4ehWzTWUrpTM:WTsKWnak5oLiApMuz9KRxcjp2BdUjzWb; expires=Fri, 30-Jun-2023 02:49:13 GMT; path=/ X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET
this the result of headers
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i wana get GMT with WebRequest
can some one plz help