You may want to change take profit, stop loss levels or expiration dates in pending orders. You can achieve this with OrderModify(...) function. This function also generates a ticket number and returns it to show user if the operations is successfull or not.
bool OrderModify(
int ticket, // ticket
double price, // price
double stoploss, // stop loss
double takeprofit, // take profit
datetime expiration, // expiration
color arrow_color // color
);
Parameters
Ticket: [in] Unique number of the order ticket.
Price: [in] New open price of the pending order.
Stoploss: [in] New StopLoss level.
Takeprofit: [in] New TakeProfit level.
Expiration: [in] Pending order expiration time.
arrow_color: [in] Arrow color for StopLoss/TakeProfit modifications in the chart. If the parameter is missing or has CLR_NONE value, the arrows will not be shown in the chart.
Returned value
If the function succeeds, it returns true, otherwise false. To get the detailed error information, call the GetLastError() function.
OrderSelect(ticketNumber, SELECT_BY_TICKET);
if(newPrice != OrderOpenPrice())
{
bool checkValue = OrderModify(ticketNumber, newPrice, OrderStopLoss(), OrderTakeProfit(), 0);
}
Post a Comment