Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1031

 
artmedia70:
Press F3 in the terminal, and manually delete this variable. It is created once and it is located in environment - the EA reads it from there. Or maybe I did not understand you correctly? You just deleted the creation of a global variable of the terminal in the indicator code itself, but it was created by this indicator before?

Artem, please help me understand what's wrong. Here https://www.mql5.com/ru/code/10237 is the code of the Expert Advisor that notifies (or rather used to notify) about all trading events in the terminal. This code has been working properly. I have been absent from the website for a long time. Some changes in mql4 have occurred and now this code compiles with an error, when compiling the initialization lines of the array. If you can find the time, please take a look at it.

Regards.

ps if anyone else can look at what the problem is, i would appreciate it.

 
AlexeyVik:
Well, I don't know, maybe in C++, which I never studied, but mql is only C-like. And secondly the array dimension cannot be set to a variable, although in your example MAX_NUM_ORDER might not be a variable...
see here about array initialization https://book.mql4.com/ru/variables/arrays
 
SunnYtheDreamer:

A row and a column of the array are selected, respectively, one particular value can be entered there, i.e. the entry should be as for an ordinary variable, and to reset all values

ArrayInitialize(Arr_Tickets, 0);



the item reference will look like this -Arr_Tickets[MAX_NUM_ORDER,2] =0;

I have it here -Arr_Tickets[MAX_NUM_ORDER][2] = {0,0, ,0,0};

 
valenok2003:
see here about array initialisation https://book.mql4.com/ru/variables/arrays
Yeah, I think the array is declared globally, so I'm getting smart...
 
valenok2003:

the item reference will look like this -Arr_Tickets[MAX_NUM_ORDER,2] =0;

I have it written -Arr_Tickets[MAX_NUM_ORDER][2] = {0,0, ,0,0};

Arr_Tickets[MAX_NUM_ORDER,2] - reference to an array element

Arr_Tickets[MAX_NUM_ORDER][2] - array element reference

The compiler does not swear however you write it and waits for one particular value, not something else. I checked it specially.
And a confirmation of the same from the link, which you gave to another forum member: the way of specifying indexes, when each of the indexes is enclosed in square brackets, is also acceptable

 
SunnYtheDreamer:

Arr_Tickets[MAX_NUM_ORDER,2] - reference to an array element

Arr_Tickets[MAX_NUM_ORDER][2] - reference to an array item

The compiler does not swear however you write it and waits for one particular value, not something else. I checked it specially.
And a confirmation of the same from the link, which you gave to another forum member: the way of specifying indexes, when each of the indexes is enclosed in square brackets, is also acceptable

I'll rephrase the question, - It used to compile and work fine, can anyone explain what's causing it? The codes that didn't work weren't allowed into the kodobase...

By the way, the error comes up in lines 53 and 54 of the code. In line 54 what is wrong? And then how to initiate a string array?

I searched through the textbook, but I didn't find anything about string arrays, there is information only about numeric arrays. Maybe I have not looked too hard? Please provide me with the link.

 
valenok2003:

Artem, please help me understand what's wrong. Here https://www.mql5.com/ru/code/10237 is the code of the Expert Advisor that notifies (or rather used to notify) about all trading events in the terminal. This code has been working properly. I have been absent from the website for a long time. Some changes in mql4 have occurred and now this code compiles with an error, when compiling the initialization lines of the array. If you can find the time, please take a look at it.

Regards.

ps if someone else look at what the problem is, i would be grateful.

First-first insert #property strict at the beginning of the code and compile.

Was like this:

#property copyright "Copyright © valenok2003@mail.ru"
#property link      "http://bluedream.ucoz.ru"

do so:

#property copyright "Copyright © valenok2003@mail.ru"
#property link      "http://bluedream.ucoz.ru"
#property strict

After that you need to look already at the errors it gives out.

 
artmedia70:

First, insert #property strict at the beginning of the code and compile.

was like this:

do so:

After that you have to look at the errors it gives out.

Inserted, nothing has changed.

Suppose I can replace line Arr_Tickets[MAX_NUM_ORDER][2] = {0,0,,0,0}; I can also replace it withArrayInitialize(Arr_Tickets,0);

What to do with string Arr_Order_Symbol[MAX_NUM_SYMBOL] = {",",};? When I try to initialize a string array throughArrayInitialize(Arr_Order_Symbol,""), it says "my you don't understand...", there is no suitable object for processing by this function...

 
valenok2003:

Inserted, nothing has changed.

Suppose I can replace line Arr_Tickets[MAX_NUM_ORDER][2] = {0,0,,0,0}; I can still replace it withArrayInitialize(Arr_Tickets,0);

What to do with string Arr_Order_Symbol[MAX_NUM_SYMBOL] = {",",};? When I try to initialize a string array throughArrayInitialize(Arr_Order_Symbol,""), it says "my you don't understand...", there is no suitable object for processing by this function...

Well, zero this array: ZeroMemory()
 
artmedia70:
Well zero this array: ZeroMemory()
I'd like to understand how to work with strings in the new mokle4. Zeroing is also a way, but it won't add understanding ))).
Reason: