Check if magicnumber exists MQL5

 

Hi

Im freaking out to check if Magicnumber XXXXXX[1-9] exist.

How can i search in heding mode for magicnumbers of actual symbol.
(I remember the way it is codet in MT4 but i can not find out how to fine it in MT5)

ist there something like:

//Loop with cnt=++
if (Search Positions (Magicnumber = myMagicnumber[cnt]) ) ...do some Code...


THANK U ;-)



 
PositionGetInteger(POSITION_MAGIC) ?
 
Alain Verleyen:
PositionGetInteger(POSITION_MAGIC) ?

Thnx 14 hours later this is how it works:

int            cnt;
int            total;
long     order_magic;

   total=PositionsTotal();
   for(cnt=0 ;cnt < total; cnt++)
     {  
      if((ticket = PositionGetTicket(cnt))>0  &&  PositionGetString(POSITION_SYMBOL) == _Symbol)
        {
         order_magic = PositionGetInteger(POSITION_MAGIC);
         if(order_magic == 123456789) ...do some code ;

       }
    }

 Now i wonder: is this the right way to do it ...?

Reason: