After Close By in MT5, two exit deals can appear while the pair's entire price result is recorded in only one of them. A zero in the other deal does not necessarily mean missing profit. Link both positions to the operation, then reconcile the combined result and costs. This mechanism applies to opposite positions in the same symbol on a hedging account where the operation is permitted. It differs from independently closing two positions at current market prices.

How does Close By differ from two separate exits?

Close By closes a position using an opposite position in the same instrument. A netting account does not hold that pair of independent positions: an opposite deal reduces, closes or reverses its single position. Do not transfer instructions between accounting modes. MT5 Help describes Close By as a hedging operation distinct from separate exits.

Symbol permission matters too: SYMBOL_ORDER_MODE must include SYMBOL_ORDER_CLOSEBY. The account's hedging label is not a complete check. Verify permissions, the actual symbol and the allowed operation. Do not open another position merely to make an opposite closure possible; that changes exposure and costs. The long and short position comparison explains the underlying directions.

Why does history show profit and zero?

The pair is closed by two OUT_BY deals. This is an entry/exit classification rather than another fee. The reference distinguishes DEAL_ENTRY_OUT_BY from an ordinary OUT and a reversal INOUT. Link the Close By order and both position identifiers instead of treating every row as an independent strategy.

The MetaQuotes AlgoBook explains that the result is recorded on the first position specified for the operation; the second exit deal records zero. Swapping the position tickets can change attribution to long and short statistics. A change in one direction's profitable-trade count therefore does not by itself establish an improvement in the strategy.

“The result of the second exit trade is always 0.” — MetaQuotes, MQL5 AlgoBook, Close By chapter; accessed 13 October 2026.

Choose the unit of analysis before calculating performance: a single deal, a complete closed position or an offset pair. In our example, two exit records describe one operation involving two positions. Treating them as independent signals changes your statistic’s denominator. Record the chosen rule in the journal and apply it to losses as well as attractive-looking profits.

How do you reconcile the pair without doubling profit?

Authored model. Assume a linear EUR/USD contract of 100,000 EUR per lot, a USD account and two 0.10-lot positions: long L opened at 1.1000 and short S at 1.1010. Prices are synthetic. Total costs for the complete pair are assumed to be 4 USD. Price, conversion-rate and execution-delay changes between variants are excluded.

Each position represents 10,000 EUR. The difference between opening prices gives (1.1010 − 1.1000) × 10,000 = 10 USD of price profit when offset. Specifying L first produces a model history with 10 USD on its OUT_BY deal and zero on S's OUT_BY deal. Reversing the order leaves a 10 USD sum while moving its attribution.

Two records do not double the result

Two records do not double the resultAuthored model: OUT_BY L records 10 USD and OUT_BY S records zero. Price total is 10 USD; assumed costs of 4 USD leave 6 USD.OUT_BY position L10 USDFirst in the operationOUT_BY position S0 USDSecond in the operationPrice total10 USDPair costs: 4 USDNet result: 6 USD; do not deduct fees again.Authored model — hypothetical values.
Authored model: OUT_BY L records 10 USD and OUT_BY S records zero. Price total is 10 USD; assumed costs of 4 USD leave 6 USD.
One pair, two ticket orders and the same model total
Ticket orderL resultS resultPrice totalAfter costs
L, then S10 USD0 USD10 USD6 USD
S, then L0 USD10 USD10 USD6 USD

Do not add another 10 USD by interpreting the second row's mirrored prices as a separate profit. Its zero result is not a missing cash amount. Reconciliation from balance before the pair opened adds the 10 USD result and deducts the 4 USD complete costs once. Check which costs were already posted at opening so they are not charged a second time in your calculation.

Break our assumed 4 USD costs into 1 USD at each position’s opening and 1 USD at each closure. Starting balance of 1,000 USD becomes 998 USD after opening fees. Closing adds 10 USD price profit and deducts 2 USD new fees, leaving 1,006 USD. The complete result is 6 USD. Do not deduct the two opening charges again from that final balance.

With that allocation, the second exit can have zero price profit and a 1 USD fee: its net entry is negative. Do not automatically call it cost-free or interpret it as an independent losing strategy signal. Assessing the pair requires every linked entry. Read the actual provider’s cost allocation rather than assuming it follows our invented split.

Why can separate closure give a different result?

For another variant, assume simultaneous Bid 1.1020 and Ask 1.1022. Closing L separately at Bid produces 20 USD, while closing S at Ask produces −12 USD: 8 USD before costs. Our Close By model produces 10 USD. The 2 USD difference equals the 0.0002 spread multiplied by 10,000 EUR. MT5 documentation describes saving one spread relative to separate closing.

This comparison holds prices and total costs constant; it does not promise the same final saving with every provider. Commission, financing, conversion charges and different execution timing can change the sum. A zero OUT_BY result does not establish zero commission. Separate price profit from costs and verify the currency of every component in deal history and the account report.

What remains when the volumes differ?

Close By offsets the common smaller quantity. Unequal sizes leave a position in the larger side's direction for the volume difference. In a revised model, L has 0.30 lot and S 0.10 lot. Offsetting 0.10 on each side leaves 0.20 lot long. The account is therefore not flat merely because an opposite-close operation appears in history.

At the same prices, the remaining 20,000 EUR long from 1.1000 to Bid 1.1020 has a modelled unrealised gain of 40 USD. Do not add that amount to balance as cash already received. Inspect the remaining position, accepted protection and future holding costs. The realised and floating P/L guide helps distinguish these amounts.

The remaining side also changes the next diagnostic question. You need evidence of its current volume and exit conditions, rather than proof that two old tickets once existed. An account statement, a current position list and the order result answer different parts of that question. Preserve each one if an outcome is unclear.

What to do tomorrow

  1. Link records belonging to one operation. In demo history, find a Close By order and its two associated OUT_BY deals. Record both position identifiers, the volume actually closed, currency and profit fields. Do not infer the pair's result from a single zero.
  2. Reconcile the total and costs. Reconstruct one pair in a separate table, adding recorded results and signed costs exactly once each. Compare that amount with balance history, keeping any remaining floating valuation and unrelated account operations separate from the closed pair's result.
  3. Verify the actual remainder. After execution is confirmed, inspect current positions and their protection. For uncertain replies, use the order-error reconciliation procedure before retrying. This settlement model is not a recommendation to open an offsetting pair of positions.