Advertisement IC Markets

Hedging Mode vs Netting Mode in MT5

Compare ECN/Raw spread brokers, analyze execution speeds, report slippage, and evaluate commission structures for high-frequency traders.
Post Reply
FXS Prop Desk
Posts: 1578
Joined: Wed Oct 07, 2026 9:52 am

Hedging Mode vs Netting Mode in MT5

Post by FXS Prop Desk »

MT5 accounts run in one of two position accounting modes, and the difference affects manual trading and EAs.

Hedging mode: each order opens a separate position. You can hold a long and a short on the same symbol at the same time. Closing requires selecting the specific position.

Netting mode: one net position per symbol. A sell order on an existing long reduces or reverses it. This is how exchange-traded futures work.

Practical effects:
  • EAs written for hedging mode may behave unexpectedly on netting accounts, and vice versa.
  • Partial closes and scaling in work differently.
  • Some prop firms specify which mode their accounts use.
The mode is shown in the account information and cannot be changed on an existing account.

Which mode does your account use, and have you run into differences between them?
FXS Official Team | The Idea Lab & Strategy
Recommended broker for automated trading & scalping IC Markets
Fairman
Posts: 6802
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Hedging Mode vs Netting Mode in MT5

Post by Fairman »

FXS Prop Desk wrote: EAs written for hedging mode may behave unexpectedly on netting accounts, and vice versa.
The most common version of that is an EA that tracks its trades by counting open positions with its magic number. On netting there's only ever one position per symbol, so a scale-in EA can think it has one trade when it actually has three added together, or a hedge EA's sell simply closes the long. In code, a quick check is ACCOUNT_MARGIN_MODE at start-up, refusing to run if it isn't the mode the logic was written for. Also, on netting the position's open price becomes an average after adding, so any stop or target calculated from the original entry price will be off. Worth testing on a demo of the same account type before going live.
It’s Fairman :geek:
Shadow Trader
Posts: 5438
Joined: Wed Sep 09, 2026 5:19 pm

Re: Hedging Mode vs Netting Mode in MT5

Post by Shadow Trader »

One more trap on netting accounts is that stop loss and take profit belong to the position, not to each order. If an EA adds a second entry and sends its own stop, that stop replaces the first one for the whole combined size.

I found that out on a demo when a scale in with a tighter stop quietly moved protection for the original entry 8 pips closer. Nothing errored, the journal just showed a modify I had not expected.

Fairman's start up check is worth doing, and note that the property has three values, not two. Retail netting, exchange netting and retail hedging all exist, and code that only tests for hedging can treat the exchange mode as something it is not.

On hedging accounts the feature I use most is close by. Settling a long against an opposite short with TRADE_ACTION_CLOSE_BY closes both at one price, so you avoid paying the spread a second time on the other leg.

Reporting differs as well. Netting history is easiest to read deal by deal, so my journal export pulls deals and rebuilds trades from them rather than trusting the position records.

Has anyone seen a prop firm run netting accounts by default? Every evaluation I have tried was on hedging.
Shadow Trader
Posts: 5438
Joined: Wed Sep 09, 2026 5:19 pm

Re: Hedging Mode vs Netting Mode in MT5

Post by Shadow Trader »

A cost that hedging mode hides well is swap on a locked position. Holding 1 lot long and 1 lot short on the same symbol often means paying negative swap on both legs, so a lock left overnight is a small guaranteed loss rather than a neutral pause.

On one of my accounts a locked EURUSD pair cost about 9 dollars a night combined, which adds up over a week of waiting for a decision. Margin differs too, since some brokers charge only the larger leg and others charge something on both.

On netting accounts the edge case I would test first is a pending order larger than the open position. A sell stop of 2 lots under a 1 lot long reverses into a 1 lot short when it fills, and an EA expecting a plain exit then manages a position it never meant to open.

The position identifier also survives that reversal, so code that treats a new identifier as a new trade will miss it. DEAL_ENTRY_INOUT is the deal type that marks the flip, and checking for it is the simplest guard I have found.

Fairman, does your start up check also refuse pending orders bigger than the current position? That seems like the natural second line of defence.
Shadow Trader
Posts: 5438
Joined: Wed Sep 09, 2026 5:19 pm

Re: Hedging Mode vs Netting Mode in MT5

Post by Shadow Trader »

MetaTrader 4 and MetaTrader 5 differ in how they treat positions, and the differences affect scalping systems. MT4 uses an order-based model, in which each trade is a separate order that can be held independently, including opposite positions on the same symbol. MT5 supports both netting and hedging account modes, depending on the broker.

In netting mode, multiple trades on a symbol merge into a single position with an average price. Closing part of it reduces size, and an opposite trade offsets rather than creating a hedge. Strategies written for MT4's order model can behave unexpectedly when moved to a netting account.

Execution modes also differ, with MT5 offering more options such as market, instant, and request execution, and various fill policies. Strategy tester engines differ too, with MT5 supporting real tick testing and multi-currency tests. Before migrating a strategy, checking the account mode and testing order logic thoroughly is essential. Assumptions that hold on one platform can silently fail on the other.
FXS Prop Desk
Posts: 1578
Joined: Wed Oct 07, 2026 9:52 am

Re: Hedging Mode vs Netting Mode in MT5

Post by FXS Prop Desk »

Fairman wrote: In code, a quick check is ACCOUNT_MARGIN_MODE at start-up
That check is cheap insurance, and worth making a hard refusal rather than a journal warning, since warnings scroll away unread. The averaged open price catches break-even logic in particular: an EA that moves the stop to entry after +10 pips will move it to the averaged price on netting, which may be nowhere near the first fill. Storing each entry price in the EA's own records instead of reading it back from the position avoids that.
FXS Official Team | The Idea Lab & Strategy
Fairman
Posts: 6802
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Hedging Mode vs Netting Mode in MT5

Post by Fairman »

I agree that a mode mismatch should fail closed, not merely print a warning. The other important case is recovery after a restart or dropped connection: an EA’s saved entry ledger can be stale while the account has a net position whose average price or volume changed after another order filled. On startup, it should reconcile its own records against current positions and deal history before sending anything, and stop for review if the state does not match the strategy’s assumptions.

For a netting strategy that manages individual entries, the platform position alone cannot preserve each fill’s separate stop logic. Keeping a durable internal record of the component entries can help, but the code still needs explicit rules for how a partial close or reversal allocates volume and risk across them. Test those transitions rather than only the happy path: add to a position, partially reduce it, reverse through zero, restart the EA, and check that stops and targets remain where intended. I would also verify the exact account mode and symbol/order settings on the same broker environment used live; a demo test is most useful when those conditions match. A concise startup report of detected mode and reconciled exposure makes later troubleshooting much easier.
It’s Fairman :geek:
Post Reply