Help maybe facing a bug with partial positions closing with OrderClose()

 

Ok, before start posting chunks of code maybe someone already experiencied this issue:

When I have 1 lot LONG position opened, I selected the position via a ticketnumber, then pass it on to :

OrderClose(ticketBuy,1,Bid,2,Red);

Now, if it is one lot, and I tell OrderClose() to close 1 lot all happens correctly.

However, if I tell OrderClose() to close 0.3 lot, the very same instant I have MT4 trading the opposite direction 0.7


In other terms

the system opens Long 1 lot

I send OrderClose for 0.7 lot

MT4 trades Long 0.3 lot ?????

In my system there is absolutely nothing else than

1 OrderSend, that happens only once, and that doesnt have a stop

1 OrderClose that happens only once, and for part of the first trade.

And despite that it does trade 3 times.

Does that ring a bell to anyone ? It's driving me mad since yesterday.

Regards,

Inquisiteur

 

Code will be needed, as far is I know (and I am still relativly new) new orders wont open without an OrderSend(......) command.

 
All is correct, you open one lot, (trade nr1) you close 0.7 lot, (trade nr2) remaining trade is trade nr3 which has a new ticket number.
 
zzuegg:
All is correct, you open one lot, (trade nr1) you close 0.7 lot, (trade nr2) remaining trade is trade nr3 which has a new ticket number.


Ah I get it, so the 3rd "trade" is not a real trade, that's just the residual after the "orderclose" right ?

What an odd way to do things...ok I get it now, thx.

Reason: