MT5 error 10020: Prices changed (TRADE_RETCODE_PRICE_CHANGED)
The price moved between your request and the server's check. Nothing was executed; take a fresh quote and send again.
What it means
You see this code in the retcode of a trade result, from OrderSend() in MQL5 or order_send() in Python.
10020 is close to a requote. The market moved while the request was in flight, and the server would not fill at the price you sent.
It is a normal answer in a fast market. It doesn't mean anything is wrong with the request.
Common causes
- A price read some time before the send.
- A small
deviationon a symbol that moves quickly. - News, the session open or thin liquidity.
How to fix it
- Read the tick right before you send, not at the start of your logic.
- Set a
deviationthat matches how far you are happy to be filled from your price. - Retry once or twice with a new price, then stop.
Example in MQL5:
MqlTradeRequest req = {};
MqlTradeResult res = {};
req.action = TRADE_ACTION_DEAL; req.symbol = _Symbol;
req.volume = 0.10; req.type = ORDER_TYPE_BUY; req.deviation = 30;
for(int i = 0; i < 3; i++)
{
req.price = SymbolInfoDouble(_Symbol, SYMBOL_ASK); // fresh each time
ZeroMemory(res);
if(OrderSend(req, res)) break;
if(res.retcode != TRADE_RETCODE_PRICE_CHANGED && res.retcode != TRADE_RETCODE_REQUOTE) break;
} Is it safe to retry?
Yes, with a new price. Nothing was filled the first time.
Could the order have executed?
No. The server didn't fill the request.
How Tickwire handles it
For market orders Tickwire retries 10020 with a fresh price, up to 2 more times, the same way it handles requotes.
MT4 error 135 comes back as 10020.
Related codes
One API for MT4 and MT5
Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.