MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  Trading functions  OrderClose

 
Use the opportunities of
MQL5 in MetaTrader 5
Study the new MQL5 language
Study the new MQL5 language.
Reference is already available
bool OrderClose( int ticket, double lots, double price, int slippage, color Color=CLR_NONE)
Closes opened order. If the function succeeds, the return value is true. If the function fails, the return value is false. To get the detailed error information, call GetLastError().
Parameters:
ticket   -   Unique number of the order ticket.
lots   -   Number of lots.
price   -   Preferred closing price.
slippage   -   Value of the maximum price slippage in points.
Color   -   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.
Sample:
  if(iRSI(NULL,0,14,PRICE_CLOSE,0)>75)
    {
     OrderClose(order_id,1,Ask,3,Red);
     return(0);
    }