MT5 error 10015: Invalid price (TRADE_RETCODE_INVALID_PRICE)

The price in the request is not allowed: wrong side of the market for a pending order, or not on the price grid. Nothing was executed.

10015TRADE_RETCODE_INVALID_PRICE
After a fixSafe to retry?
NoCould it have executed?

What it means

You see this code in the retcode of a trade result, from OrderSend() in MQL5 or order_send() in Python.

MT5 checks that each price makes sense for the order type. A buy limit must sit below the current Ask and a buy stop above it; for sells it is the other way round around the Bid.

Prices must also be on the symbol's grid: the right number of digits, and a multiple of the tick size where the symbol has one.

Common causes

  • A pending order on the wrong side, such as a buy limit above the Ask.
  • A price with too many decimals, like 1.123456789 on a 5 digit symbol.
  • A price of 0 or a value copied from another symbol.
  • A pending price inside the stops level distance from the market.

How to fix it

  • Round every price with round(price, info.digits), or to the tick size if it is bigger than one point.
  • Check the side: limits below Ask (buy) or above Bid (sell); stops the other way.
  • Keep pending prices at least trade_stops_level points from the market.

Example in Python:

import MetaTrader5 as mt5

s = mt5.symbol_info("EURUSD")
tick = mt5.symbol_info_tick("EURUSD")
gap = max(s.trade_stops_level, 50) * s.point

buy_limit = round(tick.ask - gap, s.digits)   # below the Ask
buy_stop  = round(tick.ask + gap, s.digits)   # above the Ask
sell_limit = round(tick.bid + gap, s.digits)  # above the Bid
sell_stop  = round(tick.bid - gap, s.digits)  # below the Bid

Is it safe to retry?

After you correct the price. Sending the same price again fails the same way.

Could the order have executed?

No. The request was refused before any order existed.

How Tickwire handles it

Tickwire checks that a pending price is on the correct side of the market before it sends, and refuses with 10015 if not. Nothing is sent.

MT4 error 129 and MT4 runtime error 4107 come back as 10015.

Related MT5 Python functions

All MetaTrader error codes

One API for MT4 and MT5

Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.