Magic is not working

 

Hello all,

 I am writing the order send command but the magic is not working, i assing the magic to the orders but only one trade for the same currency pair works.

I can't see what's wrong with the code, maybe it's the new mql4 language?

Here is the code:

extern int magic = 1; 

order=OrderSend(Symbol(),OP_SELL,Lot,Bid,5*Point,Ask+distance*Point,Bid-distance*TPM*Point, NULL, magic); 

 Can you see what is wrong?  

 
xredburn:

Hello all,

 I am writing the order send command but the magic is not working, i assing the magic to the orders but only one trade for the same currency pair works.

I can't see what's wrong with the code, maybe it's the new mql4 language?

Here is the code:

extern int magic = 1; 

order=OrderSend(Symbol(),OP_SELL,Lot,Bid,5*Point,Ask+distance*Point,Bid-distance*TPM*Point, NULL, magic); 

 Can you see what is wrong?  

did you pass the correct parameters?the prototype:

int  OrderSend(
   string   symbol,              // symbol
   int      cmd,                 // operation
   double   volume,              // volume
   double   price,               // price
   int      slippage,            // slippage
   double   stoploss,            // stop loss
   double   takeprofit,          // take profit
   string   comment=NULL,        // comment
   int      magic=0,             // magic number
   datetime expiration=0,        // pending order expiration
   color    arrow_color=clrNONE  // color
   );

 the slippage you pass maybe wrong,5*Point is something like 0.00005,should it be 5?

 

Hi i am not sure why you want to make the magic number a external variable, as it tells the expert which orders are his and so if you change the magic number it could cause problems upon closing the order.

I also think it's the slippage please set it to 3 or to 5 and try again.

I do not think it's the code however, i can see your use of the old code: 

extern int magic = 1;

 The new input methods are:

input int magic = 1;

 or this but i doubt it will solve the problem.

sinput int magic = 1;
Reason: