Hello,
i have compile my EA in the new MT4 editor and i get from him a error message for this lines:
The error message that i get is '[' - invalid index value
Have there somethink change complite in the new MT4 Ediotr or language, what is wrong in the array declaration that i use?
Hello,
i have compile my EA in the new MT4 editor and i get from him a error message for this lines:
The error message that i get is '[' - invalid index value
Have there somethink change complite in the new MT4 Ediotr or language, what is wrong in the array declaration that i use?
static string Cy[]; static string Newv[]; static int Tf[];
It does . . . I have done it in the past for arrays that I am always going to resize . . . for example, I used such an array in a function for a Spread MA.
Sorry but I don't understand your point. As you stated in your above post, if you need to resize an array then used a dynamic array.
The idea of Dynamic arrays doesn't exist in mql4 . . . what is the size of an array declared thus ?
string Cy[];
The idea of Dynamic arrays doesn't exist in mql4 . . . what is the size of an array declared thus ?
Ok, I see. But it seems there is now dynamic arrays, and this is why the compiler protest about [0].
Yes, of course . . . but if . . .
string Cy[]; // and string Cy[0];
. . are the same it might have been a good idea to allow 0 as an initial size of the array to help with backwards compatibility. . . . but it wasn't, so we are where we are.
Hello,
i have compile my EA in the new MT4 editor and i get from him a error message for this lines:
The error message that i get is '[' - invalid index value
Have there somethink change complite in the new MT4 Ediotr or language, what is wrong in the array declaration that i use?
In MQL4/MQL5 you can't declare an array with 0 index. However, you can declare a dynamic array that you can resize later in your code.
Example:
string Cy[]; int OnInit() { ... ArrayResize(Cy,50); ... }
You can also declare and initialize a static dynamic array as follow.
Example 2:
static string Cy[] = {"aa","bb","cc"};
Hi,
Hi personnaly used that, before resizing with the numbers of pairs selected by the trader :
double atd_AtrMarge[][][][];
and i get the same compiler message :
'[' - invalid index value
???

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
i have compile my EA in the new MT4 editor and i get from him a error message for this lines:
The error message that i get is '[' - invalid index value
Have there somethink change complite in the new MT4 Ediotr or language, what is wrong in the array declaration that i use?