Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 792

 
Artyom Trishkin:

You're the one who took 24 hours.

ZS. And you're the one who removed yourself...

I saw right away that I missed it. And I saw that you beat me to it, so I didn't bother you.

 
Artyom Trishkin:
Date-3*PeriodSeconds(PERIOD_D1);
Outputs ten-digit numbers, not the date
 
ponochka:
Outputs ten-digit numbers, not the date
Print("TimeCurrent=",TimeToString(TimeCurrent()),", TimeCurrent-three days=",TimeToString(TimeCurrent()-3*PeriodSeconds(PERIOD_D1)));


 
How can I see the source code/libraries of functions that come with MQL4? I'd like to look at their properties and make similar or better, who knows what on this subject?
 
Seric29:
How can I see the source code/libraries of functions that come with MQL4? I'd like to look at their properties and make similar or better, who knows what on this subject?

Explore the contents of the Include folder

 

There is code to output text from a link!!!


#import "wininet.dll"
int InternetOpenW(
    string     sAgent,
    int        lAccessType,
    string     sProxyName="",
    string     sProxyBypass="",
    int     lFlags=0
);
int InternetOpenUrlW(
    int     hInternetSession,
    string     sUrl, 
    string     sHeaders="",
    int     lHeadersLength=0,
    int     lFlags=0,
    int     lContext=0 
);
int InternetReadFile(
    int     hFile,
    uchar  &   sBuffer[],
    int     lNumBytesToRead,
    int&     lNumberOfBytesRead
);
int InternetCloseHandle(
    int     hInet
);       
#import

int hSession_IEType;
int hSession_Direct;
int Internet_Open_Type_Preconfig = 0;
int Internet_Open_Type_Direct = 1;

int hSession(bool Direct)
{
    string InternetAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)";
    
    if (Direct) 
    { 
        if (hSession_Direct == 0)
        {
            hSession_Direct = InternetOpenW(InternetAgent, Internet_Open_Type_Direct, "0", "0", 0);
        }
        
        return(hSession_Direct); 
    }
    else 
    {
        if (hSession_IEType == 0)
        {
           hSession_IEType = InternetOpenW(InternetAgent, Internet_Open_Type_Preconfig, "0", "0", 0);
        }
        
        return(hSession_IEType); 
    }
}

string httpGET(string strUrl)
{
   int handler = hSession(false);
   int response = InternetOpenUrlW(handler, strUrl);
   if (response == 0) 
        return(false);
        
   uchar ch[100]; string toStr=""; int dwBytes, h=-1;
   while(InternetReadFile(response, ch, 100, dwBytes)) 
  {
    if (dwBytes<=0) break; toStr=toStr+CharArrayToString(ch, 0, dwBytes);
  }
  
  InternetCloseHandle(response);
  return toStr;
}

Through this code I output text which is updated a couple of times every day! But this code takes the text once and does not update it anymore! The update occurs only when you reload the terminal!!! Is there any way to add to the code to update the displayed string?

 
ponochka:

There is code to output text from a link!!!


Through this code I output text which is updated a couple of times every day! But this code takes the text once and does not update it anymore! The update occurs only when you reload the terminal!!! Is there any way to add in the code to update the displayed string?

Call this code when you need to update the text.

 
Vladimir Pastushak:

Call this code when you need to update the text.

It doesn't work! Even if you uninstall the owl from the chart and put it back, the old text remains, not the updated ...... Only restarting the terminal helps(((
 
ponochka:
I cannot do it! Even if you unload the owl from the chart and put it back, the old text remains, not the updated..... - only restarting the terminal helps((((

Where in the EA/indicator do you call this code?

and where "return false" - add Print

 
Maxim Kuznetsov:

Where in the EA/indicator do you call this code?

and where "return false" - add Print

In onitit and in ontick added! No change