Reply To: Description of Midnight EA

Forums Strategies and Expert Advisors Midnight EA Description of Midnight EA Reply To: Description of Midnight EA


Ok it’s been a long night. I think I worked it out. MT4 uses native wininet.dll library. You can call this directly or use it through the WebRequest function in MT4. I played about with a proxy to find out what requests were being made from MT4.

   res=WebRequest("GET",url,"User-Agent:MetaTrader 4 Terminal/4.1045 (Windows NT 6.3; x64)rn",timeout,post,result,headers);
//--- Checking errors
Print("Error in WebRequest. Error code =",GetLastError());

This code basically spoofs the User-Agent to Windows 8.1 instead of XP. However the popup is being triggered on different terms. If GetLastError() (visible in the logs) comes back with 5203 then it’s the XP problem if it’s 4060 then it’s the fact you haven’t added it into MT4. Can you code that in so people don’t get confused?

Next up the calls to DailyFX and ForexFactory should be https instead of http. The http call is redirected with a 302 anyway and you’re looking at https on the next call. So please change to https?

The XP problem is due to the fact that the wininet.dll does not support TLS 1.2 which BOTH DailyFX and ForexFactory use and enforce. To test it on any system just run the internet explorer since it will use that same library as MT4 and browse either page.
For reference see
If you need to test if TLS is enabled

MT4 on Linux is emulated in Wine therefore it’s not the ideal setup. The only other option here is a reverse proxy to either of those sites using a Linux box with TLS 1.2. I noticed you scrape the data every 2minutes, does every EA do this or do they share the data? If they don’t then a reverse proxy with 1 minute cache would also tune down the amount of requests to those sites which probably have security set for multiple hits per minute. To make this work could you change the url in the code to be extern or another dropdown entry please (http://proxy.dom/ would be ideal I can redirect through hosts file)?

I’ll turn the news off for now and test 2.3. Hopefully that clears up some people’s news issues.