new Compiler

 

I have recently tried to modify an existing MQ4 indicator and with the new (joint MQL4/MQL5) compiler have masses of errors produced from a program that has worked perfectly well when compiled with the old MQL4 compiler. Below is an example:

#define ACR.Time     0  // Array Copy Rates
#define ACR.Open     1
#define ACR.Low      2
#define ACR.High     3
#define ACR.Close    4
#define ACR.Volume   5

 Errors from above code:

 

 Has the compiler changed that much or am I doing something wrong?

 thanks for any help. 

 

Dot is not allowed in name any more.

MQL now has objects and structs and dot is used for referring members and methods.

I used dots in my code like you did. It was painful replacing them. 

 

OK thanks - I wasn't 100% sure as I thought I'd compiled OK with 'dots' with new compiler before but obviously not.

Thanks a lot MetaQuotes!! 

 
drazen64: It was painful replacing them.
I use Notepad2 for all my editing. Replacing the dots took me about five minutes for 3000+ LOC. Switch to a better editor. (Notepad2 with code folding, Notepad++, there are many.)
sd59:I have recently tried to modify an existing MQ4 indicator and with the new (joint MQL4/MQL5) compiler have masses of errors produced from a program
I used that also. Don't remove/replace the dots, switch to the new structure MqlRates - MQL4 Documentation
Array Copy Rates
 New structure
#define ACR.Time     0  // Array Copy Rates
#define ACR.Open     1
#define ACR.Low      2
#define ACR.High     3
#define ACR.Close    4
#define ACR.Volume   5
   #define ACR_COUNT    6
double acr[][ACR_COUNT];
:
... ArrayCopyRates(acr, NULL, newPeriod);
:
Print("High at ", TimeToStr(acr[i][ACR.Time]),
      " was ", acr[i][ACR.High] );

 MqlRates acr[];
:
... ArrayCopyRates(acr, NULL, newPeriod);
:
Print("High at ", acr[i].time," was ", acr[i].high );
You simplify and get type checking.
 

I omitted to mention I am still trading on MT4 platform. Are your comments still valid in this case?

thanks 

 
sd59: I omitted to mention I am still trading on MT4 platform. Are your comments still valid in this case?
This is the MT4 forum.. (Of course)
 
WHRoeder:
I use Notepad2 for all my editing. Replacing the dots took me about five minutes for 3000+ LOC. Switch to a better editor. (Notepad2 with code folding, Notepad++, there are many.)

Is there a way to integrate help and/or some sort of context sensitive help in those editors?

Do they have MQL code highlighting or do you use c/c++?

 
Do they have MQL code highlighting or do you use c/c++?


Just use C++ code highlighting. Works for me.

Reason: