Closing position in a symbol

I had a problem this morning (in my software) where an existing position was closed with a lot size greater than what existed in the open position. This, naturally, opened a corresponding position in the opposite direction for the difference.

Is there a way to specify, via the Entry API, to close all lots in a given symbol? For example, if I have previously entered a BTO for EURUSD for 2 mini-lots, I want to close all open positions in EURUSD without specifying the lotsize.

Is this possible via the order entry? I see closing ALL positions, but I want to limit that to a particular symbol.

There is currently no way to do this in one step. The expectation is that your trading system does (and should?) know what your current position size is.

One possibility is to use the API command to get your current position size (cmd=positionstatus) in a given symbol, and then close that amount.


That is a good way to do it - thanks!