Skip to content

PiCo Blog

MT5 Orders, Deals and Positions: How to Check What Your Automation Actually Did

An MT5 order records a trading instruction, a deal records an execution, and a position represents the resulting holding. To check what your automation actually did, follow the instruction through those records and inspect what remains in the account. An alert notification or accepted request alone cannot answer all three questions.

The distinctions come from MetaQuotes' trading documentation. They explain several confusing situations: an accepted order with no fill yet, multiple deals from one order, and a completed trade that leaves no open position.

Order. Deal. Position.. Follow the execution evidence. Branded topic diagram.
Follow the execution evidence

Read each record for the question it can answer

Think of the records as evidence of different events, rather than interchangeable versions of “the trade”.

Evidence What it helps establish What it does not establish by itself
Alert message What the source sent. Whether the broker received or executed a request.
Terminal trading request and response What was requested and how the broker responded. That all requested volume was filled.
Order and its state The trading instruction and its progress. The final holding without checking execution and position records.
Deal or deals Executed volume, direction, price and time. What the account still holds after other activity.
Current position or positions Exposure held now. The full sequence that produced it.

For example, a pending order can be accepted while waiting for its execution conditions. Acceptance is meaningful evidence, but it is not a fill. Equally, a historical deal shows execution even if a later exit means there is no position left now. MetaQuotes describes the relationship between orders, deals and positions.

One instruction can produce several deals

One illustrative order requests 0.10 lots. Linked deals execute 0.04 and 0.06 lots, totalling 0.10 lots. Positions must be checked separately.
Illustrative record on an initially flat account, not an observed or recommended trade.

Counting deal rows is not a reliable way to count independent automation instructions. MetaQuotes states that one order can result in several deals. A requested quantity can be executed in parts rather than in one execution.

Consider this illustrative record, not an observed or recommended trade: an order requests 0.10 lots of one instrument. Two deals linked to that order execute 0.04 lots and 0.06 lots. Their total is 0.10 lots. Two deal rows in that case do not mean the bot requested two separate 0.10-lot entries.

If the only evidenced execution were 0.04 lots, you would have evidence of that executed volume, not the full 0.10 lots. You would still need the order's state to determine what happened to the remainder. Whether remaining volume stays active or is cancelled depends on the applicable order and execution rules; do not infer it from the partial deal alone.

This distinction also helps when investigating duplicate orders in trading automation. Several deals linked to one intended order and several independently submitted orders are different evidence patterns.

A deal does not always create another open position

Execution can open, reduce or close exposure. A sell execution, for example, can close an existing long rather than create an additional short position. You need the prior account state and the operation's meaning to interpret the result.

MT5 supports different position accounting systems. Under netting, one position per symbol represents the net exposure. Under hedging, multiple positions can exist for the same symbol, including opposite directions. Those distinctions are documented by MetaQuotes and explained further in netting versus hedging in MT5.

Avoid two shortcuts: “every deal creates a new position” and “an opposite order always closes my existing trade”. Neither is a reliable account-independent rule. In a hedging account, checking only total buy volume minus total sell volume can also hide separate positions that remain open.

Reconstruct one event without guessing

Start with the intended broker account and the event you want to explain. Then work through the evidence:

  1. Identify the request. Record the exact broker symbol, requested action, requested volume and time. Keep the source alert time separate from the broker execution time.
  2. Inspect the response and order state. Determine whether the request was rejected, accepted for processing, filled, cancelled or remains outstanding. Read the actual result rather than treating a generic success notification as proof of execution.
  3. Find the linked deals. Use the available order and position references, supported by symbol and timestamps. Do not join unrelated records merely because they occurred close together.
  4. Reconcile executed volume. Add the relevant deals for that order. Separate opening and closing activity when explaining the position change.
  5. Inspect current exposure and outstanding orders. Compare what remains with the intended outcome. A completed exit should be assessed against the position it was meant to close, not simply against the presence of a sell deal.

Order tickets, deal tickets and position references identify different objects. Do not assume the same number will identify every stage. Where the relationship remains unclear, retain the records for investigation instead of filling the gap with a guess.

Decide what the evidence actually supports

“The alert fired”, “the broker accepted an order”, “0.04 lots executed” and “the intended position is now closed” are different conclusions. Record the strongest one your evidence supports, along with any unexplained remainder.

If the records stop before execution, use the separate webhook received but no MT5 trade diagnosis. For supported PineConnector configuration and troubleshooting, consult the current documentation.

If the outcome is ambiguous, check positions, pending orders and history before resending. Another request can add exposure if the first one executed. The useful result of this check is an explained account state, whether that state matches the original intention or reveals a problem to resolve.

Back to PiCo Blog

Run your strategies on our managed infrastructure

Bridge routes TradingView alerts to MetaTrader. Edge hosts and runs MT5 for you.

Core Trial

Then $59/month unless you cancel.

$7for 7 days

  • 3 account connections
  • 1 hosted MT5
  • Unlimited alerts, routed by Bridge
Try Core for $7

Trusted by 66,000+ traders in 156 countries and territories · <1s typical latency

Your Edge MT5 runs in our cloud · nothing to install · built on Microsoft Azure