MQL4参考 交易函数 OrderCloseBy

OrderCloseBy

Closes an opened order by another opposite opened order.

bool  OrderCloseBy(
   int        ticket,      // ticket to close
   int        opposite,    // opposite ticket
   color      arrow_color  // color
   );

Parameters

ticket

[in]  Unique number of the order ticket.

opposite

[in]  Unique number of the opposite order ticket.

arrow_color

[in]  Color of the closing arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.

Returned value

Returns true if successful, otherwise false. To get additional error information, one has to call the GetLastError() function.

Example:

  if(iRSI(NULL,0,14,PRICE_CLOSE,0)>75)
    {
     OrderCloseBy(order_id,opposite_id);
     return(0);
    }