Array into Array

 

Hi,

i have an array with s/r-areas from h4 (srh4[]) and i want to include this array into another array which contains the d1-date (srd1[]). afterwards i want to filter out the double entries.

is this possible? which function do i have to use to include one array into another? how can i filter out double entries?

thanks!!

 
Are the entries tagged with a datetime ? if they aren't how will you tell a duplicate at the same time from a duplicate at different times ? or doesn't it matter ?
 

sorry, i explained it wrong.

one array contains s/r lines from h1:

srh1[0]=1.3754

srh1[1]=1.3777

srh1[2]=1.379

the other array has all s/r-lines from h4:

srh4[0]=1.373

srh4[1]=1.374

srh4[2]=1.3755

srh4[3]=1.3777

these arrays should be mixed together in one array. entries which are in both array should only be one time in this new array (in my example it is 1.3777).

srall[0]=1.373

srall[1]=1.374

srall[2]=1.3754

srall[3]=1.3755

srall[4]=1.3777

srall[5]=1.379

thanks!

 
If you don't care about the order you can add the arrays together then sort using https://docs.mql4.com/array/ArraySort then step through the Array, element by element, and compare each to the previous, when you find a duplicate change the previous to 0, when finished sort again and then step through to find the 0 entries and then removes these by adjusting the size of the array.
Reason: