Reply To: Description of Midnight EA

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

#4898
Dominik
Administrator

    @didom wrote:

    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
    if(res==-1)
    {
    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 https://help.salesforce.com/articleView?id=Enabling-TLS-1-1-and-TLS-1-2-in-Internet-Explorer&type=1.
    If you need to test if TLS is enabled https://tls1test.salesforce.com/s/

    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.

    Hi. Thanks.

    Midnight uses WebRequest, because Metaquotes doesn’t allow to use calls to external dlls in products published on their market.

    Of course, I can override OS in WebRequest, same with user-agent if there is possibility that some server blocks connections from MetaTrader. And I’ll add two different errors descriptions, for 5203 and 4060. As you said, http calls to both services are rediected anyway to https with 302, so it’s not a problem to change it in code in new version of Midnight, it will be some miliseconds faster by the way :)

    From version 2.3 of Midnight news are checked only at first run (initialization of EA) and then once a day some time before trading. On previous version news were checked one time per hour (and on 2.1 one time per 30 min candle).

    You can write to me PM about this proxy that you would like to use, so we’ll discuss the details and I’ll add parametr to use it.

    Regards!

    P.S. Stats from Midnight users in attachment: