I can't close an order

 

I'm writing a copy trading service


my code receive a signal and should execute it with OrderSend function

it opens the position normally without issue


but it does not close it , I give it the same attributes which used in opening it (but with reversed side(buy/sell))


inputs to open it

market > XYZ

volume > .01

side > buy


inputs to close it

market > XYZ

volume > .01

side > sell


the expected > is to close the opened one

what happens > it open a new position


what's missing ? , I have the ticket for the position and all the required info (but I found the docs here for closing the position is just by giving the same attributes with the reversed side) ( https://www.mql5.com/en/docs/constants/structures/mqltraderequest )


I see , there's OrderClose in MQL4 , but I write the script with MQL5

Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Structure
Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Structure
  • www.mql5.com
Interaction between the client terminal and a trade server for executing the order placing operation is performed by using trade requests. The trade request is represented by the special predefined structure of MqlTradeRequest type, which contain all the fields necessary to perform trade deals. The request processing result is represented by...
Reason: