OrderMagicNumber() returns

 

Hi guys

did anyone of you experienced a strange thing like the one below

OrderMagicNumber() returns negative value

and which is strange is that it repeats the same negative value across the history - anyone experienced something like that before?

here is an example of such things:

2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5779600xx267276815xx-5779600.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5765404xx266977602xx-5765404.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5764124xx266948147xx-5764124.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5659356xx265688101xx-5659356.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5626162xx264635124xx-5626162.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5582197xx264490911xx-5582197.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5608303xx264490909xx-5608303.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5589791xx264263671xx-5589791.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5582197xx264038774xx-5582197.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5407558xx261803654xx-5407558.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5359915xx261234123xx-5359915.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5407558xx261234065xx-5407558.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5314412xx260717570xx-5314412.00000000
2012.06.21 19:40:14     test_magic EURUSD,H1: OrderMagicNumber()<0-5359915xx260710894xx-5359915.00000000

below is the code how to view tickets which have negative Magic Numbers

ps: I even tried to place this info in the start function of the indicator and EA - the same thing happens

int init()
  {
     double  dMagic=0;
     int Total=OrdersHistoryTotal(); 
     for(int Index=0;Index<Total;Index++)
         { 
            OrderSelect(Index, SELECT_BY_POS, MODE_HISTORY);
            
            if (OrderMagicNumber()<0) 
            {
            dMagic = OrderMagicNumber();
            Print("OrderMagicNumber()<0"+OrderMagicNumber()+"xx"+OrderTicket()+"xx"+dMagic);
            
            }
         }   
   return(0);
  }

Thank you in Advance

 
eronyx:

Hi guys

did anyone of you experienced a strange thing like the one below

OrderMagicNumber() returns negative value

and which is strange is that it repeats the same negative value across the history - anyone experienced something like that before?

here is an example of such things:

below is the code how to view tickets which have negative Magic Numbers

ps: I even tried to place this info in the start function of the indicator and EA - the same thing happens

Thank you in Advance

Hi eronyx,

Try this :

     double  dMagic=0;
     int Total=OrdersHistoryTotal(); 
     for(int Index=0;Index<Total;Index++)
         { 
          if (OrderSelect(Index, SELECT_BY_POS, MODE_HISTORY) == true )
            //if (OrderMagicNumber()<0) 
            {
            dMagic = OrderMagicNumber();
            Print("OrderMagicNumber()<0"+OrderMagicNumber()+"xx"+OrderTicket()+"xx"+dMagic); 
            }
         }
 
onewithzachy:

Hi eronyx,

Try this :


Hi onewithzachy - thank you for suggestion but the same thing happens - they are selected and is negative the MagicNumber

it is being selected all ok - the same thing happens - it is just strange - as far as I know non of the EAs on my MT4 has negative MagicNumbers

another strange thins is that they all are of the same size if talking about the integer - so it looks there is something wrong in the memory - either the int (MagicNumber) became another type of data, but Values of int type must be within the range from -2 147 483 648 to 2 147 483 647 - so I do not think this is the case.

from another looking it looks everything works fine - the only issue I think is that I had an EA which placed negative MagicNumbers for some trades - because from thousand of trades there are only 14 trades with such MagincNumbers and they are bing selected ok and are real trades


thanx for your input onewithzachy

 
Look at the code that opened the orders. That is where the magic number is set and where the problem is.