Close by is a platform function that closes two opposite positions in the same instrument against each other in one action, instead of unwinding each of them separately in the market. It exists only on hedging-mode accounts, where a long and a short in the same symbol can be open at the same time.
The attraction is cost: the two positions are matched off internally, so the spread is not crossed twice to get out. Sizes rarely match exactly — closing a larger position against a smaller one leaves the remainder open as a new position with its own ticket — and the combined result is usually booked to one of the two tickets, which is why closed-by trades look odd in a journal or a tax export. The profit or loss is the same either way; what changes is the record.
Next step
Guide
Order Types and Slippage Explained
Market, limit and stop orders trade price certainty against execution certainty — plus what slippage is, where it comes from, and what a stop-loss caps.