OnTrade() is not working in new mt4?

To add comments, please log in or register
Ma Yuliang
293
Ma Yuliang  

I want sent a alert when a pending order be opened.

OnTrade() is not work for this .

Any one know how to do this please tell me .

Jose Francisco Casado Fernandez
5159
Jose Francisco Casado Fernandez  
OnTrade() doesn't work in MT4. You could store previous open orders and check for actual open orders every tick, and compare them with previous value. Then, store again new actual value. Regards.
Oluwatosin Aboluwarin
9254
Oluwatosin Aboluwarin  
Ma Yuliang:

I want sent a alert when a pending order be opened.

OnTrade() is not work for this .

Any one know how to do this please tell me .


   int ticket=0;
   if(orderTypeID==OP_BUYLIMIT || orderTypeID==OP_BUYSTOP)
      ticket=OrderSend(Symbol(),orderTypeID,lots,entryLevel,slippage,0.0,0.0,tradeComment,magicNumber,0,DodgerBlue);
   else if(orderTypeID==OP_SELLLIMIT || orderTypeID==OP_SELLSTOP)
      ticket=OrderSend(Symbol(),orderTypeID,lots,entryLevel,slippage,0.0,0.0,tradeComment,magicNumber,0,DeepPink);
   
   if(ticket>0)
   {
      if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
         Alert("Order ticket" + ticket + " has been opened);
   }
Jose Francisco Casado Fernandez
5159
Jose Francisco Casado Fernandez  
Oluwatosin Aboluwarin:

I think OP wants alert when pending order is triggered, not when it's placed. Regards.
To add comments, please log in or register