Understanding Hedging and How to Use “Close By” Orders in MetaTrader 5
Hedging in trading means opening opposite positions on the same instrument to reduce risk or lock in profits.
For example:
Buy 1.00 lot of EURUSD
Sell 1.00 lot of EURUSD
In MT5, the platform supports hedging mode, which allows you to hold multiple positions in both directions (buy/sell) simultaneously, instead of netting them out.
A “Close By” order allows you to simultaneously close two opposite positions (same symbol, opposite direction) with a single action. This reduces spread costs, as only one spread is charged.
Benefits of “Close By”:
- Only one spread charged (instead of two)
- Convenient for managing hedged positions
- Faster position management
When you manually close two opposite positions separately (e.g., close the Buy, then close the Sell), you pay the spread twice – once for each transaction.
Example (Separate Close):
Buy 1.00 lot of EURUSD
Sell 1.00 lot of EURUSD
If you close the Buy position, you pay the spread once.
If you then close the Sell position, you pay the spread again.
→Total: Two spreads paid
However, when you use the “Close By” function in MetaTrader 5:
The platform matches and closes both opposite positions simultaneously. Only the net difference between the two positions is processed.
As a result, only one spread is applied, because the positions offset each other.
This is especially beneficial in high-volume or scalping strategies, where reducing trading costs is critical.
Go to the “Trade” tab in your MT5 terminal. Identify the two opposite positions you want to close against each other.

Right-click on one of the two opposite positions. From the context menu, choose “Close Position”.

In the order window that appears, you will see a dropdown labeled “Close By” (or similar depending on language settings).
- Click the “Close By” tab.
- A list of eligible opposite positions will appear.
- Select the opposite position you want to pair with the current one.


After selecting the correct opposite position, click the “Close position” button to execute the operation. Both positions will be closed simultaneously.

Return to the “Trade” tab and confirm that both positions are no longer listed. You can check the “History” tab to review the closed transactions.

- “Close By” can only be used when both positions are for the same symbol and same lot size (or at least partially overlapping lots).
- If the lot sizes are different, only the overlapping portion will be closed.
