In mql4 how to you clear a multi-dimensional array?
In mql4 how to you clear a multi-dimensional array?
Loading saved threads...
rerat · External communityPost link
External question — Stack Overflow Stack Exchange
Author: rerat
Original post: https://stackoverflow.com/questions/75703578
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
string trade_data = [0][4];
ArrayResize(order_data, 2);
order_data[0][0] = "a";
order_data[0][1] = "b";
order_data[0][2] = "c";
order_data[0][3] = "d";
order_data[1][0] = "e";
order_data[1][1] = "f";
order_data[1][2] = "g";
order_data[1][3] = "h";
Now if I want to clear the 2 indexes in this 2D array, how do I do it.
I tried:
ArrayInitialize(order_data, EMPTY_VALUE)
But it gives me this error:
'ArrayInitialize' - no one of the overloads can be applied to the function call
I just want to clear the array on each For loop iteration.
Quote
Report
Yasin İPEK · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: Yasin İPEK
Original post: https://stackoverflow.com/a/75756717
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
string order_data[2][4];
order_data[0][0] = "a";
order_data[0][1] = "b";
order_data[0][2] = "c";
order_data[0][3] = "d";
order_data[1][0] = "e";
order_data[1][1] = "f";
order_data[1][2] = "g";
order_data[1][3] = "h";
ArrayResize(order_data,3);
order_data[0][0] = "a";
order_data[0][1] = "b";
order_data[0][2] = "c";
order_data[0][3] = "d";
order_data[1][0] = "e";
order_data[1][1] = "f";
order_data[1][2] = "g";
order_data[1][3] = "h";
order_data[2][0] = "j";
order_data[2][1] = "k";
order_data[2][2] = "l";
order_data[2][3] = "m";
//ArrayInitialize(order_data,EMPTY_VALUE);
for(int i=0; i<3; i++)
{
for(int j=0; j<4; j++)
{
order_data[i][j]="";
}
}
You cannot enter a string value in the ArrayInitialize method. Here are the values you can enter: char,short,int,long,float,double,bool,uint
Quote
Report
Post Reply
Checking account access…