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

 
valenok2003:

Can you people tell me what the error is in this line? before compiled without error messages, now - '{' - expression expected

Thanks in advance

Arr_Tickets[MAX_NUM_ORDER][2] = {0,0, ,0,0};


Count the commas.
 
AlexeyVik:

Count the commas.
The commas are correct, it's the notation that no matter how many elements the array contains, they will all be filled with zeros.
 
abeiks:

Hello.

I'm currently trying to figure out the global variables. Now there is one problem and I can't solve it. If I delete a global variable from the indicator, the Expert Advisor keeps getting that variable. How can I solve this problem?

Press F3 in the terminal and manually delete this variable. It is created once and it is located in environment - the Expert Advisor 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 already created by this indicator?
 
artmedia70:
Press F3 in the terminal and manually delete this variable. It is created once, and is in the environment - that's where the EA reads it from.
Thank you! I did not know.
How can I check and delete this in the Expert Advisor itself? For example, if I close the indicator by mistake, the EA will always get that last variable and if there is a signal to open positions...
 
valenok2003:

a how do you delete?


I did that, but it's not right:

 if (!GlobalVariableCheck("Test_1"))
GlobalVariableDel("Test_1"); 
 
valenok2003:
The commas are correct, it's the notation that no matter how many elements an array contains, it will all be filled with zeros.
Well, I don't know, maybe in C++, which I never studied, but mql is only C-like. And secondly, you can't set the array's dimension to a variable, although in your example MAX_NUM_ORDER may not be a variable...
 
valenok2003:

Can you people tell me what the error is in this line? before compiled without error messages, now - '{' - expression expected

Thanks in advance

Arr_Tickets[MAX_NUM_ORDER][2] = {0,0, ,0,0};

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

ArrayInitialize(Arr_Tickets, 0);

 
abeiks:

I did that, but it's not right:

if (!GlobalVariableCheck("Test_1"))
GlobalVariableDel("Test_1"); 

What does it say?

If there is no global variable named Test_1, delete it...

 
abeiks:
Thank you! I didn't know.
And how to make such a check and delete it in the Expert Advisor itself? For example, if I accidentally close the indicator, the Expert Advisor will receive this last variable all the time and if there is a signal to open positions there...
If the unintentional deletion of the indicator should delete the global variables created by this indicator, the deletion of these global variables should be prescribed in the OnDeinit() function of the indicator.
At the same time, you must check that it is not a timeframe switch, but the deletion of the indicator from the chart.
 
artmedia70:
If the unintentional deletion of the indicator should delete the global variables created by this indicator, the deletion of these global variables should be prescribed in the OnDeinit() function of the indicator.
It should be checked that it is not a timeframe switch, but the deletion of the indicator from the chart.
Thank you!
Reason: