Please tell me about ordermodify

 

I have a question.

I have already ordered and after that I want to change only takeprofit by using order modify but I don't want to change stoploss.

I want to modify only takeprofit.

double TP=0;

Modified=OrderModify(OrderTicket(),OrderOpenPrice(),SL,TP,0,clrNONE);

If I want to use original stoploss, How can I put SL?

 

Make sure that the order is selected.

For the SL parameter use OrderStopLoss()

 
if( OrderTakeProfit() != ТР )
        OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), ТР, 0, clrNONE);
 

Hello friend,

You can try this out. It's no where near prefect, but it should give you some ideas.

void ModifyOrder()
  {x=0;   TakeProfit=0;
   int   TotalOrders=OrdersTotal();
   for(TotalOrders=OrdersTotal();TotalOrders>x;x++)
     {
      trade      = OrderSelect(x,SELECT_BY_POS)==true;
      Watch      = SymbolName(x,true);
      SL         = MarketInfo(Watch,MODE_STOPLEVEL);
      ticket     = OrderTicket();
      order_type = OrderType();
      Price      = OrderOpenPrice();
      TakeProfit = OrderTakeProfit();
      Price_difference=_Point*SL;
      if(order_type==OP_SELL)     {TakeProfit=Price-Price_difference;}
      else TakeProfit=Price+Price_difference;
      if(order_type==OP_SELL)     {Stoploss=Ask+Price_difference;}
      else Stoploss=Bid-Price_difference;
      bool TrailingStop=OrderModify(ticket,Price,Stoploss,TakeProfit,0,clrGray);
      if(!TrailingStop) Operation();
      else Operation();
     }
  }
 
GrumpyDuckMan:

Hello friend,

You can try this out. It's no where near prefect, but it should give you some ideas.

Wow! So many help. I will try that. Doumo arigatou.