Exempting order from orderselect once specific conditions are met.

 

Hello, 

while coding my brand new EA recently I came accross a quest. 


Basically i need to avoid orders which met a certain condition to be modified by my tick-bound modify function. 

So i thought about making it the way the expert advisor creates a sort of "Blacklist" with the Ticket numbers of orders which met the condition. 

Such condition is when the stop loss is placed at BE.




int BlackListOrderTicket(){


int Ticket;


   for(int i=0;i<OrdersTotal();i++)

   {

      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;

      if(OrderMagicNumber()!=HMAGICMA || OrderSymbol()!=Symbol()) continue;

      if(OrderStopLoss() == OrderOpenPrice()) continue;

      Ticket = OrderTicket();

      

      SendNotification(StringConcatenate("L'ordine #",OrderTicket()," è stato aggiunto alla Modifying-Blacklist. Le modifiche a questo ordine di hedging non verranno più apportate."));

            return(Ticket);

   }   

}


what do you guys think? Can this work? 

 

Forum on trading, automated trading systems and testing trading strategies

When you post code please use the CODE button (Alt-S)!

Use the CODE button

 
@Sergey Golubev ok thanks 
 

Hello, 

while coding my brand new EA recently I came accross a quest. 


Basically i need to avoid orders which met a certain condition to be modified by my tick-bound modify function. 

So i thought about making it the way the expert advisor creates a sort of "Blacklist" with the Ticket numbers of orders which met the condition. 

Such condition is when the stop loss is placed at BE.










int BlackListOrderTicket(){



int Ticket;



   for(int i=0;i<OrdersTotal();i++)

   {

      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;

      if(OrderMagicNumber()!=HMAGICMA || OrderSymbol()!=Symbol()) continue;

      if(OrderStopLoss() == OrderOpenPrice()) continue;

      Ticket = OrderTicket();

      

      SendNotification(StringConcatenate("L'ordine #",OrderTicket()," è stato aggiunto alla Modifying-Blacklist. Le modifiche a questo ordine di hedging non verranno più apportate."));

            return(Ticket);

   }   

}




what do you guys think? Can this work?