Download MetaTrader 5

Dot in variable name

To add comments, please log in or register
Terrence Brannon
204
Terrence Brannon  

In this MQL4 source code, we see dots in variable names, e.g.:

extern bool    ShutDown.NOW=False;

However, when I compile the code, the compiler expects a semicolon where there is a dot above.

 A similar question has been asked and the replies made it seem that a dot could be part of a variable name. But my MT4 compiler doesnt think so.

Drazen Penic
2579
Drazen Penic  

Since version 600, MQL4 has structs and objects and dot is used to delimit objects/structs and their members. 

Terrence Brannon
204
Terrence Brannon  
drazen64:

Since version 600, MQL4 has structs and objects and dot is used to delimit objects/structs and their members. 

 


OK, but no struct or object was declared in the source code. I am using MT4 from FinFX. It is version 4, build 646. The associated MetaEditor is version 5, build 934.
Drazen Penic
2579
Drazen Penic  

Since v600 it is reserved for structures and objects and cannot be used in variable names.

Old EA's worked because MT4 v600+ update has "old" runtime environment  for old compiled code, but if you want to compile the code with new compiler, you can't have dots in variable name. 

GreenMoney
379
GreenMoney  

Last year, MetaQuotes started to make significant changes to the mql4 compiler.  See Beta Version of MetaTrader 4 IDE Including New MQL4 Compiler and Editor.  One of those changes was to no longer allow coders to use a dot (aka, period) in variable name.  This change was necessary because MetaQuotes was also introducing OOP concepts, including use of a "dot operator".

The code you are looking at and trying to compile appears to have been created in the mid-to-late 2000s (2006 to 2008), and it appears to significantly use a dot in variable names.  To compile that code with a 600+ compiler, you will have to make lots of changes to it, e.g., remove the dot in the variable names. 

To add comments, please log in or register