New MetaTrader 4 Client Terminal Build 507: Trading Signal Registration Command and Setting a Spread When Testing - page 6

 
I've reported it to the Service Desk with code and a link to this thread.
 
cody_r:
I've reported it to the Service Desk with code and a link to this thread.
Thank you. 
 
RaptorUK:
Thank you. 

cody_r:
I've reported it to the Service Desk with code and a link to this thread.

Awesome! 

 
RaptorUK:

I don't have enough information and cannot provide code to reproduce the issue.


Just put an unused function at the top of your code. That'll do it.

int test()
{
  return (1);
}

int start()
{
  return(0);
}
 
euclid:


Just put an unused function at the top of your code. That'll do it.

Nope,  it didn't . . .
 
Is it me or metaquotes stopped pushing the 507 update to clients that were not updated yet?
 

I had a very peculiar issue this morning after my MT4 platform had updated to build 507.  An EA that I had been happily compiling and running on Friday suddenly started failing to load with the message: "executable file is corrupted. Please recompile it."  Just to be sure that everything was the same build level, I downloaded and reinstalled MT4, which had no effect on the problem. 

After some investigation, I think I have tracked the problem to having some internet access code in a function that is not actually called by the EA.  For example, the code shown below, when compiled, gives me the "corrupted" message when I drag it onto a chart.  If, however, I open up the commented lines, recompile and run it, the call appears to work ok and prints a reasonable value for stringlen(sData). 

 I have other EAs that use this code to access internet data and they all appear to be working ok after recompilation.  It just seems to be the fact of having the code in the EA but not calling it that causes the issue. 

 Anyone any ideas what might be wrong? 

Thanks, Greg 

//bool try=true;
//string sData;
bool bWinInetDebug = false;
int hSession_IEType;
int hSession_Direct;
int Internet_Open_Type_Preconfig = 0;
int Internet_Open_Type_Direct = 1;
int Internet_Open_Type_Proxy = 3;
int Buffer_LEN = 80;
#import "wininet.dll"
#define INTERNET_FLAG_PRAGMA_NOCACHE    0x00000100
#define INTERNET_FLAG_NO_CACHE_WRITE    0x04000000
#define INTERNET_FLAG_RELOAD            0x80000000
int InternetOpenA(
  string   sAgent,
  int    lAccessType,
  string   sProxyName="",
  string   sProxyBypass="",
  int   lFlags=0
);
int InternetOpenUrlA(
  int   hInternetSession,
  string   sUrl,
  string   sHeaders="",
  int   lHeadersLength=0,
  int   lFlags=0,
  int   lContext=0
);
int InternetReadFile(
  int   hFile,
  string   sBuffer,
  int   lNumBytesToRead,
  int&   lNumberOfBytesRead[]
);
int InternetCloseHandle(
  int   hInet
);
#import
int hSession(bool Direct)
{
  string InternetAgent="";
  if (hSession_IEType == 0)
  {
    InternetAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)";
    hSession_IEType = InternetOpenA(InternetAgent, Internet_Open_Type_Preconfig, "0", "0", 0);
    hSession_Direct = InternetOpenA(InternetAgent, Internet_Open_Type_Direct, "0", "0", 0);
  }
  if (Direct)
  {
    return(hSession_Direct);
  }
  else
  {
    return(hSession_IEType);
  }
}
bool GrabWeb(string strUrl, string& strWebPage)
{
  int   hInternet;
  int    iResult;
  int   lReturn[]  = {1};
  string   sBuffer    = "                                                                             
                                                                                                        
                                                                          ";
  int   bytes;
  hInternet = InternetOpenUrlA(hSession(FALSE), strUrl, "0", 0,
                INTERNET_FLAG_NO_CACHE_WRITE |
                INTERNET_FLAG_PRAGMA_NOCACHE |
                INTERNET_FLAG_RELOAD, 0);
  if (bWinInetDebug)
  {
      Print("Accessing URL: " + strUrl);
      Print("hInternet: " + hInternet);
   }
  if (hInternet == 0)
  {
      Print("Zero return from InternetOpenUrlA - iResult=" + iResult);
      return(false);
   }
  iResult = InternetReadFile(hInternet, sBuffer, Buffer_LEN, lReturn);
  if (iResult == 0)
  {
      Print ("Zero result from InternetReadFile");
      return(false);
   }
  bytes = lReturn[0];
  strWebPage = StringSubstr(sBuffer, 0, lReturn[0]);
  while (lReturn[0] != 0)
  {
    iResult = InternetReadFile(hInternet, sBuffer, Buffer_LEN, lReturn);
    if (lReturn[0]==0)
      break;
    bytes = bytes + lReturn[0];
    strWebPage = strWebPage + StringSubstr(sBuffer, 0, lReturn[0]);
  }
  iResult = InternetCloseHandle(hInternet);
  if (iResult == 0)
  {
      Print ("Zero result from InternetCloseHandle");
      return(false);
   }
  return(true);
}
int init()
{
   return(0);
}
int start()
{
/*   if (try)
   {
      string    sUrl = "http://www.forexfactory.com/ffcal_week_this.xml";
           GrabWeb(sUrl, sData);
           Print(StringLen(sData));
           try=false;
        }*/
   return(0);
}
 
gregspinner:

I had a very peculiar issue this morning after my MT4 platform had updated to build 507.  An EA that I had been happily compiling and running on Friday suddenly started failing to load with the message: "executable file is corrupted. Please recompile it."  Just to be sure that everything was the same build level, I downloaded and reinstalled MT4, which had no effect on the problem. 

After some investigation, I think I have tracked the problem to having some internet access code in a function that is not actually called by the EA.  For example, the code shown below, when compiled, gives me the "corrupted" message when I drag it onto a chart.  If, however, I open up the commented lines, recompile and run it, the call appears to work ok and prints a reasonable value for stringlen(sData). 

 I have other EAs that use this code to access internet data and they all appear to be working ok after recompilation.  It just seems to be the fact of having the code in the EA but not calling it that causes the issue. 

 Anyone any ideas what might be wrong? 

OK,  thanks for posting code,  I can reproduce this issue when using your code as a script  .  .  .

 

2013.06.24 10:29:54 gregspinner GBPUSD,H1: executable file is corrupted. Please recompile it.

 

I suspect that it is related to the imports and not just simply having code that is unused  . . .   


 

Having the same problem.. buid 507. To me it seems like the problem has something to do with dll. After moving indicator that 507 claimed to be corrupted to another terminal i was able to run it but it did not start executable which was supposed to be started by ShellExecuteA from within the indicator, neither did dll api to that executable work after manually starting the exe.

 I did try to locate the problem by quoting of some code but as a result of recompiling terminal crashed and wont start again...

 

I won't post my confidential code either.

I've Windows 7 x64, UAC turned off and I'm outside the Program Files (x86) directory.

If I'm using my own include files, I got the  "executable file is corrupted. Please recompile it." error message. If I copy'n'paste the code from the mqh files, the error message is gone.

I agree with RaptorUK, the problem is not with the unused code but the import mqh files.

My include file structure working flawless since build 226, so I guess I could go out to have a coffee instead of worry about my working code turning in to something unusable by one upgrade. 

I'm always using build 226 compiler, so I'm not frightened.

Bugs are bugs, I can see that. The problem is MetaQuotes publishing their new builds too early, forcing many people into changes which were demanded years ago. Nobody will die if the testing period will expand the release date of any kind of new build.

By the way, regarding the new version's description (first post of this topic):

1) the distance calculation shouldn't be writing pips; it should be points. 1 classic pip equals 10 points in 3/5 digits forex symbols. 

2) the first image is fake and wrong. 55 points (not pips!) is the distance between the new sell limit and the current bid price, and not between the old and new desired sell limit.

3) Of course, with usual broker condition 55 pips of 1.00 lot EURUSD generates 550 USD profit or loss, so this points to my first observation - points, not pips!