how to Manipulate a particular order instead of the whole position?

 

Dear all,

Think I have bought 3 lots of contacts by sending several OP_Buy commands at different prices. Can I use the OrderSend() or CTrade class to close or modify particular one of these orders as I do with the orignal OrderClose() OrderModify() in MQL4? I guess If I use CTrade::PositionClose(), the whole position with its 3 lots will be closed.

  I am not familiar with the new concepts introduced in MQL5. Maybe I asked a wrong quetion. So thank you for your patience in advance.

 
taozemin:

Dear all,

Think I have bought 3 lots of contacts by sending several OP_Buy commands at different prices. Can I use the OrderSend() or CTrade class to close or modify particular one of these orders as I do with the orignal OrderClose() OrderModify() in MQL4? I guess If I use CTrade::PositionClose(), the whole position with its 3 lots will be closed.

  I am not familiar with the new concepts introduced in MQL5. Maybe I asked a wrong quetion. So thank you for your patience in advance.

You can send OP_SELL order to close a part of your position. In MT5/mql5 there is no concept of a trade with open/close as in MT4, there are deals BUY/SELL (in/out) which results in a position.

See this article Orders, Positions and Deals in MetaTrader 5


 
angevoyageur:

You can send OP_SELL order to close a part of your position. In MT5/mql5 there is no concept of a trade with open/close as in MT4, there are deals BUY/SELL (in/out) which results in a position.

See this article Orders, Positions and Deals in MetaTrader 5


Dear angevoyageur,

   Thank you for your kind reply. I hope I can understand it better this time.

Reason: