OrderModify Only Modifies Buy Trades

 
for (int i=0; i<OrdersTotal(); i++) {
OrderSelect(i,SELECT_BY_TICKET,MODE_TRADES);
//Alert("Order Ticket = ", OrderTicket(), " Order Open Price= ", OrderOpenPrice());
ticket=OrderTicket();
pricelevel=OrderOpenPrice();
OrderModify(ticket,pricelevel,NormalizeDouble(Bid-Point*500,Digits),NormalizeDouble(Bid+Point*500,Digits),0,Blue);
}


The following code only modifies buy trades while sell trades are not modified. How do i make it to modify both sell and buy trades. Thanks.

 
pirokele: How do i make it to modify both sell and buy trades.

If it's a sell trade, how do you think you can place the SL below market?

 
pirokele:


The following code only modifies buy trades while sell trades are not modified. How do i make it to modify both sell and buy trades. Thanks.

Try something like this...

   bool ModifyOrders=false;
   for(int i=0; i<OrdersTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_TICKET,MODE_TRADES))
        {
         //Alert("Order Ticket = ", OrderTicket(), " Order Open Price= ", OrderOpenPrice());
         ticket=OrderTicket();
         pricelevel=OrderOpenPrice();
         if(OrderType()==OP_BUY)
            ModifyOrders=OrderModify(ticket,pricelevel,NormalizeDouble(Bid-500*Point,Digits),NormalizeDouble(Ask+500*Point,Digits),0,clrBlue);
         if(OrderType()==OP_SELL)
            ModifyOrders=OrderModify(ticket,pricelevel,NormalizeDouble(Ask+500*Point,Digits),NormalizeDouble(Bid-500*Point,Digits),0,clrRed);
        }
     }

 
Nikolaos Pantzos:

Try something like this...


Thanks so much.