Multi Dymension array..how to

 
I know how to place info into a single dymension array

CalculationResult = Result of some function or forumla for each bar in chart.

double Data[];

Start loop i

Data[i] = CalculationResult

end loop i

But if I wish to store two pieces of information in the array, like Date and 'CalculationResult' for the bars on chart. How is that done.
- I dont know what size the array would be as chart bars number can change.
- Can MT4 Multi arrays store two or more data types like Date and Double ( Are the structures for this variable ??)
- I need to add data and be able to get data out..

So how does a loop look on a multi dymension array anyways !

I found this from zolero : 'Getting prices from another symbol?'

double array[x][6];
x- length of data or number of Bars
the second dimension is information about Time, Open, Close, High, Low, Volume

Q: So how does the loop look like, as an example ?
 
I don't get it, All this information is already available in predefined arrays.
 
irusoh1 wrote:
I don't get it, All this information is already available in predefined arrays.

I have amended my request...my data is not predefined.

If I wish to store DATE, CALCULATIONRESULT in a two dimension array, so how is that done ??
 
there no structures in mql4

so, the easiest just to create as many arryas as necessary and refer to them with single index to retrieve values.

datetime DATE[10];
double CALCRES[10];

thisdate=DATE[3];
thisres=CALCRES[3];

something like that.
 
irusoh1 wrote:
there no structures in mql4

so, the easiest just to create as many arryas as necessary and refer to them with single index to retrieve values.

datetime DATE[10];
double CALCRES[10];

thisdate=DATE[3];
thisres=CALCRES[3];

something like that.

That is not good for sorting...
 
and why not... you know they say that bad dancer has got his legs in the way. Anyway it's a russian saying.
 
irusoh1 wrote:
and why not... you know they say that bad dancer has got his legs in the way. Anyway it's a russian saying.

WHY cant I get a straight amswer....

I just want a example of using a two dimension array, with two data types like double and string.

TO see looping, and assigning values into array...

Jes wayne ...
 
array double[][2];
ArrayResize(array, 10); //10 or whatever (like number of bars).
ArrayInitialize(array, 0);
for(int i = 0; i < 10; i++)
{
array[i][0] = /*date time */;
array[i][1] = /*double calc */;
}
 
Craig:
array double[][2];
ArrayResize(array, 10); //10 or whatever (like number of bars).
ArrayInitialize(array, 0);
for(int i = 0; i < 10; i++)
{
array[i][0] = /*date time */;
array[i][1] = /*double calc */;
}



Thanks...
 
icm63:
Craig:
array double[][2];
ArrayResize(array, 10); //10 or whatever (like number of bars).
ArrayInitialize(array, 0);
for(int i = 0; i < 10; i++)
{
array[i][0] = /*date time */;
array[i][1] = /*double calc */;
}



Thanks...

"ArraySort" function shorts array of one dimenson, ....so how do I sort the above array on the array[i][1] data..DESCENDING

array double[][2];

should be

double array [][2];

etc
 
ArraySort sorts an array of any dimension by the the first dimension.
Reason: