OrderOpenPrice

 
Hello i want to know the code of comparing OrderOpenPrice of order with current price


Thanks




 

there's more then a way to code it , but here is one :

you should set this variabile:

   double MyOrderOpenPrice()
   {
   double opPrice= 0;
   for(  i=OrdersTotal()-1; i>=0;i--){
   if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
   if(OrderSymbol()==Symbol() && OrderMagicNumber()== magic){
   opPrice=OrderOpenPrice();
   break;
   }
   }
   return(opPrice);
   }

and then add this to your buy or sell condition:

if(Ask>= MyOrderOpenPrice())

or

if(Bid<=MyOrderOpenPrice())

but as  I said , there's more options to do that

Reason: