How to compare str and str in the string array ? - page 2

 
ubzen:

Just grab the first 6 letters with



you mean I can grab the str from the array and campare with the current order's ?
 
dabbler:

Think about it for a while. You know how to access element n in an array, it is theNameofYourArray[n].

Keep a count of the elements as you add them, then you will know where the last element is and therefore where to add the new one.


if(...==...)
 {
  for(int j=0;j<=count;j++)
   {
        if(OrderSymbol( )==A[j])
              break;
   }
   if(j>count)
   {
        A[j]=OrderSymbol( );
        count++;
if I use above, the return is 0. so thatis the reason I didn't use a for loot before in the message .
 
oxeno:

if I use above, the return is 0. so that is the reason I didn't use a for loop before in the message .

That code is looking good. That is what you need to do. So there is a bug in it because it is not doing what you want. BUT it is close to what you need.

Notice that if you have 5 elements they are labelled [0] to [4]. The j loop needs to test < count not <= count.

You are getting there :-)

 
oxeno:

you mean I can grab the str from the array and campare with the current order's ?

if(MarketInfo(OrderSymbol(),MODE_MARGININIT)==100x
&& StringSubstr(OrderSymbol(),0,6)==StringSubstr(Symbol(),0,6)
){
   Alert( " I Have The Pro Account && Symbol Is Chart Symbol " );
}
Reason: