MT4 error 145: Modification denied because order is too close to market (ERR_TRADE_MODIFY_DENIED)
You tried to change an order or its stops while the price was inside the freeze level. Nothing changed; wait for the price to move.
What it means
You see this code in GetLastError() in MQL4, after a trade function fails on the server side.
When the market is within the broker's freeze level of an order's price or stops, MT4 won't let you change them.
It stops last moment changes right before a level is hit.
Common causes
- Moving a stop that the price is about to reach.
- Changing or deleting a pending order about to trigger.
- A wide freeze level around news.
How to fix it
- Read
MarketInfo(sym, MODE_FREEZELEVEL)and skip changes inside that distance. - Try again once the price moves away.
Example in MQL4:
double freeze = MarketInfo(Symbol(), MODE_FREEZELEVEL) * Point;
if(OrderSelect(ticket, SELECT_BY_TICKET) && OrderType() == OP_BUY)
{
if(OrderStopLoss() > 0 && Bid - OrderStopLoss() <= freeze)
Print("Inside the freeze zone: leave the stop alone for now");
} Is it safe to retry?
Yes, once the price is outside the freeze zone.
Could the order have executed?
No. Your change wasn't applied.
How Tickwire handles it
Tickwire treats it like MT5 10029, and the MT4 code stays in the message. See trade results.
Related codes
One API for MT4 and MT5
Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.