MQ4 / EX4 Naming Conventions?

 

Hi everybody.

I am curious to know whether there are any rules regarding what you can input as a name for a .ex4 file?

I have three EA .mt4 source files. When compiled into a .ex4 (with no errors), one of them runs perfectly live and during backtesting, while the others stare back at me blankly doing nothing. The three file names are:

  1. MQL_Cornelius_MACD_Grid v2020.04.26 18h.ex4 [time and date of compilation]
  2. MQL_Cornelius_MACD_Grid v1.01.ex4
  3. monkey junk.ex4

File #1 works perfectly. File #2 and #3 do nothing. Files #2 & #3 are exact copies of file #1 (save as...), except with the name having been changed... and yet they do not run.

Would anybody have an idea of why something like this might happen?

It's driving me bananas.

Cornelius

 
In future please post in the correct section
I will move your topic to the MQL4 and Metatrader 4 section.
 
Zippu: Would anybody have an idea of why something like this might happen?
  1. Bad characters in Windows would be " : / \ * ?
  2. Make sure you don't have a trailing blank (after ex4)
  3. You copied files, perhaps the tester is confused; restart the terminal.
 
Keith Watford:
In future please post in the correct section
I will move your topic to the MQL4 and Metatrader 4 section.

Thanks Keith, didn't realize.

Cornelius

 
William Roeder:
  1. Bad characters in Windows would be " : / \ * ?
  2. Make sure you don't have a trailing blank (after ex4)
  3. You copied files, perhaps the tester is confused; restart the terminal.

Hi William, thanks for the suggestions.

No bad characters, exact names indicated above. I also checked for the blank after the extension (which there shouldn't be since I changed the source code's name in meta editor and compiled to get the ex4) as well as resetting the terminal to no avail.

It's quite a mind boggling issue, considering that the file which is working also started with a different name.

Is it possible that even though I have changed the name in the editor via "save as" and recompiled under the new name, that the new ex4 is trying to reference the original name somehow? Or perhaps carries a file property related to the original name that creates a dissonance that the strategy tester cannot understand?

Grasping at straws :)

Cornelius

 

If important, I'm compiling using meta editor v5 build 23361 08 march 2020

Trying to run on MT4 version 4 build 1260 24 jan 2020


Although I don't see that this would make a difference since the output is ex4?

 
  • are there any error messages in the log file?
  • do you have the indicator name hardcoded somewhere in your code? (iCustom call, licence verification, ...)
  • do you use new style events (OnCalculate(), OnInit(), OnDeinit())



 
Drazen Penic:
  • are there any error messages in the log file?
  • do you have the indicator name hardcoded somewhere in your code? (iCustom call, licence verification, ...)
  • do you use new style events (OnCalculate(), OnInit(), OnDeinit())



Hi Drazen, thanks for taking the time.

The first point was a good idea, I hadn't thought of that.  Sadly no - it loads the EA without issue, and then it says that it processes (in my setup) 1960 bars in 0.9s. The end result is that no trades are made over the entire period.

No special indicators used.

For the events that you indicate, I don't think that I have any of those in particular. My code setup (after external variable definitions) is the following:

int init()
  {
//---
   return(INIT_SUCCEEDED);
  }
 
int deinit()
  {
  return 0;
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start(){

code

}


Thanks for your help!

 
Zippu:

Hi Drazen, thanks for taking the time.

The first point was a good idea, I hadn't thought of that.  Sadly no - it loads the EA without issue, and then it says that it processes (in my setup) 1960 bars in 0.9s. The end result is that no trades are made over the entire period.

No special indicators used.

For the events that you indicate, I don't think that I have any of those in particular. My code setup (after external variable definitions) is the following:

int init()
  {
//---
   return(INIT_SUCCEEDED);
  }
 
int deinit()
  {
  return 0;
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start(){

code

}


Thanks for your help!


First, I misread your post, I thought this was an indicator, but it's an EA, so you don't need OnCalculate, that is for indicators.

Try to replace start() with OnTick()

You might try to create new empty EA with editor and then copy function signatures and replace old style functions with OnInit, OnDeinit and OnTick()

This might require you to add "#property strict" at the beginning of your code and that will probably cause number of warnings and errors.


I saw several indicators and EA's that use old-style syntax which MT4 could not properly recognize. MT4 introduced new style syntax in 2014, so you might expect that old code will have more problems with each new version. You should probably try to migrate your EA to the new style syntax.

 
Drazen Penic:


First, I misread your post, I thought this was an indicator, but it's an EA, so you don't need OnCalculate, that is for indicators.

Try to replace start() with OnTick()

You might try to create new empty EA with editor and then copy function signatures and replace old style functions with OnInit, OnDeinit and OnTick()

This might require you to add "#property strict" at the beginning of your code and that will probably cause number of warnings and errors.


I saw several indicators and EA's that use old-style syntax which MT4 could not properly recognize. MT4 introduced new style syntax in 2014, so you might expect that old code will have more problems with each new version. You should probably try to migrate your EA to the new style syntax.

Hi Drazen, thanks a lot.

Before even seeing your response I'd decided to just start over again with a generated template while using the working code as a guide, but not a word for word copy. The first thing that I noticed after using the template generator was that this code was using OnTick(), instead of Start().

The freshly generated code does not include "property strict" on its own - I'll add it now on your recommendation.

Thanks for your help!

Reason: