Download MetaTrader 5

new Compiler

To add comments, please log in or register
sd59
509
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 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. 

Drazen Penic
2730
Drazen Penic  

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. 

sd59
509
sd59  

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!! 

whroeder1
16286
whroeder1  
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.
sd59
509
sd59  

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

thanks 

whroeder1
16286
whroeder1  
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)
Drazen Penic
2730
Drazen Penic  
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++?

SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  
Do they have MQL code highlighting or do you use c/c++?


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

To add comments, please log in or register