saving data on HD

 
hi all,

i need your help on that: is there an away i can save an array and its index all together?

i have a array let's say array_mine[counter]... i want to save its content indexed with the counter.

it seems like it should be easier... so please any help is must appreciated. thanks.

,,,
 
brspMA:
hi all,

i need your help on that: is there an away i can save an array and its index all together?

i have a array let's say array_mine[counter]... i want to save its content indexed with the counter.

it seems like it should be easier... so please any help is must appreciated. thanks.

,,,

Hi brspMA,

A 2 dimensional array can be considered as a 2 rows of table. So, for example :

declaring size of array_mine[2][10]; will give you 1 row for storing 10 values, and another 10 for its counter.

calling array_mine[0][4] will give the value of member 5; and array_mine[1][4] will give the member 5 counter...

 
thanks cameofx!

so what you are saying is that i should save both information separated in order to link the content with the counter. is that what you've just said?

let's say i have the array_my [counter] where:

the content is iMA ema;
and the counter is the time for that content;

notice that the content is linked with its time, and it is of no use if i do not know the time it was generated. i just want to save this information on the HD for future access.

thank you,,,
 
brspMA:
thanks cameofx!

so what you are saying is that i should save both information separated in order to link the content with the counter. is that what you've just said? .........

brspMA, I just read this, sorry for the belated reply... been on & off net connection this few days...

- we usually use a variable (i.e. bar count) as counter. With Time Series we don't need a variable to store it .

- when we use 'i' counter to store value's array, we link the array index with bar index count.

- In other words, the way to link several values to an index/counter is to store it with the same index count, keeping in mind it's values are more easy to read when all indexes are in the same direction.

- you most probably have known all the above, it's just to make things clear for me also...

- If you meant save both information separate as in separate arrays, then NO. The example I posted was rather to solve it with only one array. A maximum of four dimension can be used. This is a workaround use of array's features to our benefit. To elaborate more on the example; the first dimension can be used to store values, second, counter, third, High at that moment, forth, Low at that moment. Keep in mind they have to be in the same type. Counter in this case can be double, not a problem.

- quote : "and the counter is the time for that content;" I don't fully understand.. If you need to call the time of a value why not use the value's bar index and call TIme[i] ?

 
brspMA:

let's say i have the array_my [counter] where:

the content is iMA ema;
and the counter is the time for that content;

notice that the content is linked with its time, and it is of no use if i do not know the time it was generated. i just want to save this information on the HD for future access.

thank you,,,

counter can be time I guess if that's what you're after - since it's stored as integer. But it may have disadvantages. we use counter usually as arithmetic addition or other operations that's constant and without gap. Time on chart can have gaps and different interval... Besides, index counter to address array can only be integer.

Here is an example of more usual way to store array and its time... (sorry, if you already knew..just to make a point)

double array_my[]; // to store ema values

datetime ema_time[]; // to store time of ema values

int i = 0; // we still need an integer counter to address the values!

for (i=Bars-1; i<0; i--)

{  array_my[i] = iMa(......., MODE_EMA,...);

   ema_time[i] = Time[i];
}

// to know any values and it's time simply call both array of the same index. 
// i.e. array_my[29] value has the time of ema_time[29]
 
cameofx:
" the first dimension can be used to store values, second, counter, third, High at that moment, forth, Low at that moment."

This is not correct...my mistake...

If I want to store four different values on a single 2-dimensional array, simply declare the 2nd dimension to be 4, for example : double array_4values [4][10];
Adding size to the 2nd dimension can be regarded as adding rows...
4 dimensional array have different properties than what I described for this purpose. Please see Array reference.

Reason: