How to Tell if MT5 Uses Netting or Hedging
The account mode explains why the same sell order can reduce an existing long on one MetaTrader 5 account and open a separate short on another. Netting combines executed deals into one position per symbol. Hedging keeps positions separate and can allow positions in both directions. Check which mode your broker assigned to the connected account before interpreting the Trade tab or configuring an Expert Advisor.
Steps to check
- Confirm the connected account's mode with the broker or read ACCOUNT_MARGIN_MODE from MT5. An MQL5 program can read it through AccountInfoInteger. ACCOUNT_MARGIN_MODE_RETAIL_NETTING and ACCOUNT_MARGIN_MODE_EXCHANGE use netting for positions. ACCOUNT_MARGIN_MODE_RETAIL_HEDGING uses hedging. Check the setting again when you change accounts or broker servers.
- On a netting account, start with the position volume for the exact symbol and compare it with the executed opposite volume. A smaller deal reduces the position, an equal deal closes it, and a larger deal reverses it with the excess volume. A deal executed in the same direction increases the existing position. Use the deal volume from history if the order filled only in part.
- On a hedging account, inspect the symbol and ticket of each position. An ordinary opposite order can open a new position if the broker allows both directions on the same symbol. To reduce a particular position in the desktop platform, select Close Position from that position's menu and specify the volume to close. An MQL5 close request for a hedged position identifies it in the position field.
- After a demo execution, compare the deal record in History with the positions listed in Trade. Record the exact symbol, direction, executed lots and remaining position volume. If several positions appear, verify which ticket you targeted and which positions remain. The comparison tells you whether the deal reduced exposure on an existing position or opened a separate leg.
- Test any position-management logic against the mode of the demo account you are using. Check partial fills, position selection and the closing volume as separate cases. For any comparison between the two account modes, record spread, commissions and overnight financing where applicable. These costs are separate from the rule that groups deals into positions.
Worked example
Suppose a demo account starts with a 0.30 lot long. An ordinary sell for 0.10 lots on the same symbol fills completely. On a netting account, one long position remains at 0.20 lots. On a hedging account that permits opposite positions, the original 0.30 lot long and the separate 0.10 lot short can both remain open. Both outcomes have a signed difference of 0.20 lots long, but the hedged outcome still has two positions to manage.
Frequently asked questions
Does MT5 use one account mode for every broker account?
The broker sets the position accounting system for the account. Confirm it on the particular account you are connected to, including when you switch between demo and live.
Why did Sell open another position instead of closing my Buy?
On a hedging account, an ordinary Sell can open a separate short if opposite positions are allowed. To close the original long, select its position and use the close command for that ticket.
Can I identify the mode by seeing just one position?
One position on a symbol is possible in either mode. Confirm the account mode directly with your broker or read the account property before using position count as evidence.
Related guides
Related video
Related MT5 automation setup example