Download MetaTrader 5

How to modify pending order price of of Binary option?

To add comments, please log in or register
Oidov
14
Oidov  

I would like to change stop pending order price of Binary option. and write below code but does not work. Can i modify pending order price of BO or What is wrong here?

 bool fm;
   for (int i=0; i < OrdersTotal(); i++)
   {
      if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) 
      {
         if (OrderSymbol()==Symbol()&&OrderMagicNumber() == Magic_Number) 
         {
            if (OrderType()==OP_BUYSTOP) 
            {
               if (OrderOpenPrice() > (double)DoubleToString(Ask+Point*(ModifyPendingOrderStop+ModifyPendingOrderStep-1),Digits)|| OrderOpenPrice() == 0)
               {
                  fm=OrderModify(OrderTicket(),(double)DoubleToString(Ask+Point*ModifyPendingOrderStop,Digits),OrderStopLoss(),OrderTakeProfit(),0,Pink); 
                  return;
               }
            } 
            if (OrderType()==OP_SELLSTOP) 
            {
               if (OrderOpenPrice() < (double)DoubleToString(Bid-Point*(ModifyPendingOrderStop+ModifyPendingOrderStep-1),Digits)) 
               {
                  fm=OrderModify(OrderTicket(),(double)DoubleToString(Bid-Point*ModifyPendingOrderStop,Digits),OrderStopLoss(),OrderTakeProfit(),0,Pink);
                  return;
               }
            }
         }
      }
   }
To add comments, please log in or register