Ask

 

Nice  to meet every one.

What function can be used in MT5 to close a openned position trade?

OrderClose?

Thanks Very much. 

 
There is no OrderClose() anymore. You have to market an order of the same size, opposite direction.
 

Use predesigned library Trade.mqh for this purpose.

#include <Trade\Trade.mqh>

CTrade position;

 More info can be found here: https://www.mql5.com/en/docs/standardlibrary/tradeclasses/ctrade

Documentation on MQL5: Standard Library / Trade Classes / CTrade
  • www.mql5.com
Standard Library / Trade Classes / CTrade - Documentation on MQL5