Skip to content
realtrademaster

MT5 Error 10038: Close Volume Exceeds Position Size

MetaTrader 5 retcode 10038 means the requested close volume is larger than the current position volume. Begin with the position the request actually targeted and check its remaining volume after recent deals. A quantity copied when an order first opened can become stale after a partial close. In a hedging account, picking the wrong same-symbol ticket can produce a similar mismatch.

Steps to check

  1. Identify the outgoing close action using the request log. Note the exact position ticket, broker symbol, close quantity in lots and server timestamp. Check the actual payload when an EA computes one size and submits another after its validation or rounding step.
  2. Refresh the open position and read its current volume. Use the intended ticket when the account can hold multiple positions on the same symbol. If the position is absent, move to History and confirm its last state using its related deals.
  3. Check the recent closing deals for that position. A partial close, an earlier automated request or another action on the same account may already have reduced the available volume. Compare the recorded quantities and timestamps before attributing the result to the broker's minimum lot.
  4. Compare the remaining lots with the requested close quantity and the exact symbol's volume constraints. In a demo test, record each change before the next request is composed. Where the plan still calls for a partial close, check the proposed remainder as well.

Worked example

Suppose a demo position opened at 0.50 lots and a first close deal removed 0.30 lots. The position now shows 0.20 lots. A second request built from the old 0.50-lot snapshot asks to close 0.30 lots and receives 10038. The recent deal and the live position explain the discrepancy. Record both before deciding what the original close logic was supposed to do with the remaining 0.20 lots.

Frequently asked questions

How is error 10038 different from an invalid volume error?

10038 specifically compares the close amount with the current position volume. Code 10014 addresses an invalid request volume, which can involve the symbol's minimum or increment.

Can the original order volume be used for a second close?

Use the freshly selected position volume for that comparison. The original order size tells you what opened originally and can be stale after a partial fill or close.

Why does the position ticket matter in hedging mode?

A hedging account can hold several positions on the same symbol. Compare the outgoing close amount with the specific position targeted by the request.

Related guides

Related video

Related video: understand what a lot represents

Watch on YouTube

Sources