Download MetaTrader 5

Check if magicnumber exists MQL5

To add comments, please log in or register
Add the thread to Favorites. Track the changes even faster!
Zar88
64
Zar88 2016.11.25 10:09 

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 ;-)



Alain Verleyen
Moderator
30707
Alain Verleyen 2016.11.25 15:54  
PositionGetInteger(POSITION_MAGIC) ?
Zar88
64
Zar88 2016.11.28 05:17  
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 ...?

To add comments, please log in or register