How do I compare values?

 

I have 28 arrays. Every array has double values. How i code to compare these values? For eample i want to find the second value from 28 values for every order(secondvalıue[i]) Please show some simple codes. Thanks.

 

Hello ensar,

Please add a new comment and click SRC button to include your code so a community member or I can see it and offer you a possible solution.

What do you wish to code? Calculations for entry/exit signals or something else?


"i want to find the second value from 28 values for every order(secondvalıue[i])"

I think you coded a single array containing 28 indexes (not 28 arrays) and you wish to check the return value of the second index of your array every order send, yes-err something similar.

Thank you

 

Ashley i have 28 arrays. I want to compare each index of arrays and find the second high value. maybe third value

arr1[i]= "value1"
arr2[i]= "value2"
arr3[i]= "value3"
.
.
.
arr28[i]= "value28"

//find the second index of arrays

secondhigh[1] = arr3[1]
secondhigh[2] = arr18[2]
secondhigh[3] = arr25[3]
 
ensark:

I have 28 arrays. Every array has double values. How i code to compare these values? For eample i want to find the second value from 28 values for every order(secondvalıue[i]) Please show some simple codes. Thanks.

This might help a little  https://www.mql5.com/en/forum/144779
 
ensark:

Ashley i have 28 arrays. I want to compare each index of arrays and find the second high value. maybe third value

 

1. Are you trying to save the last bar's High/Low value or the last tick's High/Low value?  (what data do you wish your code to save?)

2. Why do you code 28 arrays when you can simply code a single array possessing 28 indexes? (think "most efficient" but not too efficient or code then becomes incomprehensible.)

2. example:

//array possessing 28 indexes
array[28];
//array possessing 3 indexes
array[3];
/*instead of-
secondhigh[1] = arr3[1];
secondhigh[2] = arr18[2];
secondhigh[3] = arr25[3];*/

First, identify what data you wish your code to save then-

        state in a comment this data you wish your code to save.

Second, comment what task you wish your code to perform using this data.

Thirdly, someone else or me will reply to your comment with a solution if possible.

Thank you

 

do this...

associate them...

for(int i = 0; i < 28; i++){

 if( array1[i] == array2[i] ){

Print("if only i got paid to do this"); 

 
trevone:

do this...

associate them...

for(int i = 0; i < 28; i++){

 if( array1[i] == array2[i] ){

Print("if only i got paid to do this"); 

static double array[2];

for(int i=0;i<28;i++){
    if(array[1]==array[2])
       Print("");    
    
    else continue;}
Thank you
 

at the end, i coded for you guys :) it works

for (int p = 0;p<28; p++)
{ 
int l =0;
 for (int k = 0;k<28; k++)
   { 
   if( pair[p]< pair[k])
    l =l+1;
 else   if( pair[p]>= pair[k])  
    l =l+0;
   } 
 if ( l ==26)
  firstvalue[i]= pair[p]; 
 
 if ( l ==25)
  secondvalue[i]= pair[p]; 
 
 if ( l ==24)
  thirdvalue[i]= pair[p];
  
 } 
Reason: