Netting vs Hedging in MT5: Positions, Deals and P/L
See why the same executed buy and sell deals produce different position books. Replay netting and hedging side by side, reconcile realized and floating P/L, and separate a new order from closing a ticket.
Author · Editor
- Author
- Mykola Zavarov
- Editor
- Andriy Bondarenko
Reviewed

The essentials
Netting maintains one position per symbol; hedging can keep separate positions, including opposing ones.
A new opposite deal reduces, closes or reverses a netting position. In hedging, a new opposite deal opens another position; closing an existing ticket is a different action.
The replay uses fictional EUR/USD executions, zero costs and one common hypothetical mark. Equal total P/L under these assumptions does not establish equal real-account costs or margin.
Net and gross volume answer different questions. Check account mode, permissions and the intended operation before interpreting a position list.
Order, deal and position are different objects
You buy EUR/USD and later enter a new sell order for the same symbol. Why does one MT5 account show a smaller position while another shows both a buy and a sell? The answer begins with the account’s position-accounting system and with what the submitted instruction actually requests.
Term | What it represents |
|---|---|
Order | An instruction to buy or sell under specified conditions. An unfilled order does not itself create a position. |
Deal | An executed transaction. One order can be executed through more than one deal. |
Position | The resulting open trading obligation recorded by the account’s accounting system. |
Scroll sideways to compare all columns ↔
MetaTrader 5’s basic principles distinguish these objects and the netting and hedging systems. Do not use an order number, an execution and an open position as interchangeable descriptions. A history of completed orders alone does not explain which positions remain open.
In this guide, “hedging” means the MT5 position-accounting mode. The label does not establish that a particular combination reduces risk or is an effective hedge.
How a new deal changes each position book
With netting, a symbol has one common position. Another deal in the same direction adds volume; an opposite deal reduces it, closes it exactly or reverses it, depending on the quantity. In hedging, a new deal can create another position in the same or opposite direction. These are the platform’s accounting distinctions, not a choice made by renaming a trade.
New executed deal against an existing long | Netting | Hedging: new position operation |
|---|---|---|
Buy more | Increase the common long; recalculate its weighted entry. | Open another long position. |
Sell less than the existing long | Reduce the long; the remainder keeps its entry price. | Open a separate short; the original long remains. |
Sell exactly the existing long quantity | Close the common position. | Keep the long and open an equal short. |
Sell more than the existing long quantity | Close the long and open the excess as a short. | Keep the long and open the full new short. |
Scroll sideways to compare all columns ↔
The table assumes a new position operation in hedging. An explicit instruction to close a selected existing position has a different purpose. MetaTrader’s execution documentation describes adding volume and closing operations; it is essential to distinguish the requested action from the buy or sell direction alone.
The accounting system is a property of the trading account, set through the broker’s account arrangements. An explanation of one account does not prove that another account at the same broker has identical permissions or settings.
Replay the same deals in both books
Replay the same executed deals in two position books
Compare Netting and Hedging for one teaching EUR/USD sequence. Every row is a new, already executed BUY or SELL deal. Quantities are EUR units; model P/L is in USD.
This lab has zero costs and one hypothetical common mark price. It does not fetch quotes or reproduce a broker account. Presets are invented; pasted deals are your supplied assumptions, not independently verified records.
A new opposite deal reduces, closes or reverses the Netting position. In Hedging it opens another ticket and leaves earlier tickets open. Explicitly closing a selected position is a different action and is not modeled here.
Step 3 of 3; common mark 1.115 USD/EUR.
Netting · one aggregate position
- Current direction
- Long EUR
- Weighted average entry · USD/EUR
- ≈ 1.10333333
- Long quantity · EUR
- 6,000.00
- Short quantity · EUR
- 0.00
- Gross quantity · EUR
- 6,000.00
- Net quantity · EUR
- +6,000.00
- Realized model P/L · USD
- +120.00
- Floating model P/L · USD
- +70.00
- Total model P/L · USD
- +190.00
Realized 120.00 + floating 70.00 = total 190.00 USD.
Hedging · separate open tickets
Hedging tickets still open: 3
- Long quantity · EUR
- 12,000.00
- Short quantity · EUR
- 6,000.00
- Gross quantity · EUR
- 18,000.00
- Net quantity · EUR
- +6,000.00
- Realized model P/L · USD
- 0.00
- Floating model P/L · USD
- +190.00
- Total model P/L · USD
- +190.00
Realized 0.00 + floating 190.00 = total 190.00 USD.
At this step both zero-cost books have total 190.00 USD. They process identical executed quantities and prices at the same mark. The split into realized and floating P/L and the gross open quantity can differ. This equality does not establish equality of real account costs, margin or risk.
Hedging tickets still open
T1, T2 and so on are teaching labels, not MetaTrader server ticket numbers. Each new deal opens a separate ticket; this lab has no selected-ticket close action, so Hedging realized P/L remains zero.
| Teaching ticket | New deal side | Quantity · EUR | Entry execution · USD/EUR | Floating model P/L · USD |
|---|---|---|---|---|
| T1 | BUY · buy EUR | 10,000.00 | 1.10 | +150.00 |
| T2 | SELL · sell EUR | 6,000.00 | 1.12 | +30.00 |
| T3 | BUY · buy EUR | 2,000.00 | 1.11 | +10.00 |
Deal-by-deal accounting
Each row shows both books immediately after that new deal, valued at the common mark. The first row is the empty starting state. This is not a history of changing market valuations.
| Step | New executed deal | Effect on Netting | Netting net · EUR | Netting average · USD/EUR | Netting realized · USD | Netting floating · USD | Hedging gross · EUR | Hedging floating · USD | Total in either book · USD |
|---|---|---|---|---|---|---|---|---|---|
| 0 | — | No deal yet | 0.00 | — | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 1 | BUY · buy EUR 10,000.00 EUR at 1.10 | Open the aggregate position | +10,000.00 | 1.10 | 0.00 | +150.00 | 10,000.00 | +150.00 | +150.00 |
| 2 | SELL · sell EUR 6,000.00 EUR at 1.12 | Reduce; retain the average of the remaining position | +4,000.00 | 1.10 | +120.00 | +60.00 | 16,000.00 | +180.00 | +180.00 |
| 3 | BUY · buy EUR 2,000.00 EUR at 1.11 | Add and recompute the weighted average | +6,000.00 | ≈ 1.10333333 | +120.00 | +70.00 | 18,000.00 | +190.00 | +190.00 |
Tables scroll horizontally. Focus a table region and use arrow keys if needed.
Displayed quantities use 2 decimal places; prices and P/L use up to 8. Repeating values are rounded only for display. Weighted averages are never rounded before calculating P/L. The CSV includes exact fractions and separate readable decimal columns.
Download the current books and ledger · CSVThe CSV includes only processed deals, both books, open teaching tickets, common mark and zero-cost assumptions. English machine headers, decimal dots and exact fractions make the result auditable. Import exact-fraction columns as text so a spreadsheet does not convert them into dates.
No Close Position, Close By, commission, spread, slippage, swaps, margin, stop-out, FIFO, SL/TP, partial fills or server rules are simulated. BUY and SELL prices are supplied execution prices. A single common mark deliberately removes Bid/Ask valuation differences. Account mode and available operations depend on the actual account and broker.
This component calculates in this browser tab without sending your input or saving it in browser storage. A file is saved only when you choose to download it. This statement covers the lab, not the rest of the site.
Each row below is a newly executed buy or sell deal in fictional EUR/USD, with quantity in EUR and execution price in USD per EUR. The tool accepts one to eight deals. Quantities are positive, up to 1,000,000 EUR with two decimal places; execution prices and the mark are positive, up to 1,000 USD per EUR with five decimal places. Decimal commas are accepted.
The two books receive exactly the same rows in the same order. In the hedging book, every row opens a new teaching ticket. There is no hidden ticket closure, matching rule or Close By operation. The ticket labels help track the example; they are not real MT5 account identifiers.
- Apply the example and move from step zero through the executed deals. Step zero has no positions or realized P/L.
- Compare the remaining quantity, entry prices and realized P/L after each deal.
- Inspect the separate hedging tickets and the long, short, net and gross EUR volumes.
- Use the reduction, equal-opposite, reversal and addition examples to isolate one accounting change at a time.
One common hypothetical mark values every displayed step. It is not a historical sequence of market prices or a backtest. Changing that mark changes floating P/L; it does not change execution prices or already realized P/L. Adding a later deal does not rewrite an earlier step’s book.
Editing inputs hides the previous results and current CSV until valid changes are applied. The supplied reference example, downloadable files and protocol remain available without JavaScript; editing and stepping require JavaScript. The model excludes spread, commission, financing, margin, liquidation, stops and server execution rules.
Reconcile a reduction followed by an addition
Use these three hypothetical executions and a common mark of 1.11500 USD per EUR. Prices are already filled prices. The examples explain accounting after execution, not whether those fills would have been obtainable.
Step | New executed deal | Netting position after the deal | Netting realized P/L, cumulative |
|---|---|---|---|
1 | Buy 10,000 EUR at 1.10000 | Long 10,000 EUR at 1.10000 | 0 USD |
2 | Sell 6,000 EUR at 1.12000 | Long 4,000 EUR at 1.10000 | 120 USD |
3 | Buy 2,000 EUR at 1.11000 | Long 6,000 EUR at 1.103333… | 120 USD |
Scroll sideways to compare all columns ↔
The second deal realizes 6,000 × (1.12 − 1.10) = 120 USD and leaves 4,000 EUR at the original entry. The third adds 2,000 EUR. The weighted entry becomes (4,000 × 1.10 + 2,000 × 1.11) / 6,000 = 1.103333… USD per EUR. Keep that value unrounded when calculating P/L.
At the mark of 1.115, netting floating P/L is 6,000 × (1.115 − 1.103333…) = 70 USD. Together with 120 USD realized, total model P/L is 190 USD. The displayed repeating average is an explanation, not a rounded input to that calculation.
Hedging retains three tickets: the first long contributes 150 USD floating, the short contributes 30 USD, and the final long contributes 10 USD. Nothing has been closed, so realized P/L is zero and floating P/L is 190 USD. Long volume is 12,000 EUR, short volume 6,000 EUR, gross 18,000 EUR and net +6,000 EUR.
Equal volume, reversal and weighted entry
Now isolate two deals: buy 10,000 EUR at 1.10, then sell 10,000 EUR at 1.12. Netting is flat and has realized 200 USD. Hedging keeps two opposing tickets, with zero net EUR volume and 20,000 EUR gross volume. At a common mark M, floating P/L is 10,000(M − 1.10) + 10,000(1.12 − M) = 200 USD.
The mark cancels algebraically in that equal-volume example. It does not turn the hedging book into closed positions or prove anything about required margin, financing or withdrawable funds. Both books received two executions of 10,000 EUR; the accounting mode alone does not establish that one execution schedule costs less.
For a reversal, change the second sell to 15,000 EUR at 1.12. Netting closes the original long, realizes 200 USD and opens a short of the excess 5,000 EUR at 1.12. At mark 1.115, that short contributes 25 USD floating, for a total of 225 USD. Hedging instead holds the original 10,000 EUR long and the full 15,000 EUR short; floating P/L is 150 + 75 = 225 USD.
Same-direction additions work differently from reductions. As a separate same-direction example, a buy of 10,000 EUR at 1.10000 followed by 5,000 EUR at 1.10600 gives a netting entry of 1.10200 for 15,000 EUR. A partial reduction leaves the entry of the remainder unchanged; a reversal assigns the new excess position the reversing deal’s price. There is no single entry price for a hedging book containing opposite tickets.
Keep volume and P/L measures separate
Measure | Definition in this EUR/USD model |
|---|---|
Long volume / short volume | Sum of the open EUR quantities in each direction. |
Net volume | Long minus short, in EUR. Positive means net long; negative means net short. |
Gross volume | Long plus short, in EUR. It counts open quantities without offsetting directions. |
Realized P/L | P/L attributed to quantities closed by the modeled netting operation. |
Floating P/L | Open long Q × (mark − entry), or open short Q × (entry − mark), in USD. |
Total model P/L | Realized plus floating P/L, with the stated zero-cost assumptions. |
Scroll sideways to compare all columns ↔
For the same executed deals and common mark, the model conserves total P/L across the two accounting books. Netting moves part of the result into realized P/L when opposite quantities meet; hedging leaves these new tickets open. The equality follows from the arithmetic of the same signed executions, not from a claim about actual account equity.
Zero net EUR volume does not mean no positions exist. Gross volume and individual tickets still describe the open hedging book. Conversely, gross volume is not a loss estimate or margin formula. Different currencies would need their own units; this replay deliberately stays with EUR/USD.
The currency correlation and exposure guide addresses another question: co-movement and currency composition. A correlation coefficient cannot identify which ticket a platform closes, and this accounting replay does not estimate a hedge ratio or a probability of loss.
Closing a ticket is not opening its opposite
On a hedging account, distinguish a new opposite entry from an explicit close of a selected position. A close operation identifies the position being reduced or closed and the applicable quantity. A newly executed opposite entry in this replay identifies no position to close, so it leaves every existing hedging ticket open.
MetaTrader’s closing instructions explain closing a chosen position, including a partial quantity. For example, reducing a selected 10,000 EUR long by 6,000 EUR leaves 4,000 EUR of that position. That intended operation must not be confused with opening a new 6,000 EUR short. This replay models only the latter kind of new entry.
Close By is another specific operation described by MetaTrader for opposing positions in the same symbol on a hedging account. Where the operation is available, it closes positions against one another; if their volumes differ, a remainder stays in the larger direction. This guide does not treat it as interchangeable with two arbitrary market orders or promise a cost advantage.
Record the operation as well as its direction: new entry, selected-position close or a supported Close By. This replay has no ticket-closing controls: every row means a new executed entry.
Check the account instead of inferring its rules
Confirm the actual account’s accounting mode and permissions. MQL5 Account Properties distinguishes margin/accounting mode, permission for opposing positions and a FIFO-close flag. When the FIFO-close flag is true, closing must follow the oldest-position-first requirement. The relevant restriction is the actual account setting.
Hedging capability does not imply zero margin for matching long and short quantities. MetaTrader’s margin documentation describes broker-configured treatment of covered volume. The method and symbol specifications matter. This replay does not calculate a margin discount or compare the margin charged by real accounts.
The handling of Stop Loss and Take Profit differs between accounting systems; consult the relevant MetaTrader accounting rules and the broker’s actual specifications. An opposite entry should not be used to infer that another ticket’s protective levels were changed or removed. No stop levels are simulated here.
Real executions can also have different costs, prices and funding treatment. The guide to slippage explains why an intended price and a fill may differ. Zero-cost equality in this replay cannot establish equal net account results after spreads, commissions, swaps or different closing operations.
For an account-specific margin question, inspect the symbol and account terms before using a margin-level calculation. The forex-versus-futures comparison separately explains instrument structure. Neither the word “hedging” nor a zero net quantity substitutes for those specifications.
A short checklist for reading a position book
- Confirm the account mode and any closing restrictions from the actual account’s documentation.
- Distinguish the submitted order, its executed deals and the resulting open positions.
- Record whether an opposite instruction opens a new position or explicitly closes a selected existing one.
- Use quantities in identified units, execution prices and an explicit valuation mark; separate realized and floating amounts.
- Reconcile long, short, net and gross volume without treating them as margin or loss estimates.
- Keep costs, funding and broker rules outside a zero-cost example until they have been specified and verified.
If a discrepancy appears, reproduce one position and one subsequent deal before adding rows. Check the intended operation, then quantities and prices. A larger history will not repair a mistaken assumption about which position was closed.
Use the forex backtesting guide for research that needs historical signals and modeled execution timing. This replay starts after execution and compares position accounting. Its downloadable protocol records assumptions and observations; it does not certify a trading strategy or a live account.
Frequently asked questions
Is hedging mode safer than netting?
The accounting label cannot establish safety. It changes how positions are recorded and which operations close them. Quantities, directions, execution costs, account rules and the rest of the portfolio still matter. This guide compares bookkeeping under explicit assumptions and recommends neither account mode nor a trade.
Why did a sell create another position instead of closing my buy?
A new opposite entry on a hedging account can open a separate position. Closing an existing position is a distinct operation that identifies the position to close. Confirm the account mode and the operation submitted; the direction “sell” alone does not explain its effect.
Can I switch netting to hedging with an opposite order?
No. An opposite order does not change the account’s accounting system. The mode belongs to the account and its broker arrangements. Confirm the available account type and any change procedure with the broker rather than assuming that a trading action changes the setting.
Why do both books show equal total P/L in the replay?
They receive the same executed deals, use zero costs and value all remaining quantities at one common mark. Under those assumptions, realized plus floating P/L reconciles algebraically. Real accounts can differ through costs, execution, valuation and closing rules, so the equality is not a promised live outcome.
Does zero net volume mean zero margin?
No. Net quantity offsets direction; it does not define the broker’s margin method. Equal opposing tickets may still have positive gross volume, and their treatment depends on account and symbol settings. The replay shows quantities and hypothetical P/L, not collateral or liquidation requirements.
Does this tool simulate Close Position, Close By or stops?
No. Every entered row is a new executed deal; every hedging row opens a new teaching ticket. Selected-ticket closes, Close By, FIFO handling, SL/TP, spread, commission and financing are outside the model. Use the official platform and account documentation for those operations.
Sources & further reading
- MQL5 — Account PropertiesChecked