OrderModify

 

When I want to modify only the stop loss of an opened order, should I use zeros for price, takeprofit and expiration parameters as shown in the following?

OrderModify(OrderTicket(), 0, newStop, 0, 0)
 

You can't use zero for the price, A) can't modify price of an open order, or B) zero is an invalid price. You can use zero for the others if you don't want them.

Use the actual values OrderOpenPrice(), OrderTakeProfit() and OrderExpiration()
          Trade Functions - MQL4 Reference

You would know that had you bothered to look at the example provided

bool res=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Point*TrailingStop,Digits),OrderTakeProfit(),0,Blue);
          OrderModify - Trade Functions - MQL4 Reference
 
whroeder1:

You can't use zero for the price, A) can't modify price of an open order, or B) zero is an invalid price. You can use zero for the others if you don't want them.

Use the actual values OrderOpenPrice(), OrderTakeProfit() and OrderExpiration()
          Trade Functions - MQL4 Reference

You would know that had you bothered to look at the example provided


Thanks,


If we want to change the stop loss of a pending order, same is valid?

As the reference says that "Open price and expiration time can be changed only for pending orders. If unchanged values are passed as the function parameters, the error 1 (ERR_NO_RESULT) will be generated."

 
ERR_NO_RESULT
You Server
Change the SL to XIt is at X!
Change the SL to X It is at X!
Change the SL to XYou are insane
So don't call modify without changing something.
 
whroeder1:
ERR_NO_RESULT
You Server
Change the SL to XIt is at X!
Change the SL to X It is at X!
Change the SL to XYou are insane
So don't call modify without changing something.


Thank you, so clear )
Reason: