OrderClose - all lots and ignore slippage

 

I want to close a position entirely. It does not matter what its lot size, slippage or whether it is long or short. What parameters should I put in? Would 0 work?

OrderClose(OrderTicket(),0,0,0,Violet); 
 
eempc:

I want to close a position entirely. It does not matter what its lot size, slippage or whether it is long or short. What parameters should I put in? Would 0 work?

You have to do what the Documentation says . . . OrderClose() the color parameter is optional, the rest aren't. Select the Order then you can use OrderLots(), OrderClosePrice() and OrderTicket()
 

I was hoping the default settings of 0 could just ignore the parameter and close off completely.

Lot sizes are determined in relation to account size (which obviously changes) so I guess I will have to record the lot size at the time the order opened, and then write a separate OrderClose for longs and shorts.

 
eempc:

I was hoping the default settings of 0 could just ignore the parameter and close off completely.

Lot sizes are determined in relation to account size (which obviously changes) so I guess I will have to record the lot size at the time the order opened, and then write a separate OrderClose for longs and shorts.

Erm . . . as I said,

Select the Order then you can use OrderLots(), OrderClosePrice() and OrderTicket()

 
eempc: I want to close a position entirely. It does not matter what its lot size,
You must put the full order size (OrderLots) to close entirely. Zero would mean close nothing.
Reason: