Trade server return code
10025 TRADE_ RETCODE_ NO_ CHANGES
No changes: a modification that changes nothing
What it means
The request asks to set the stop loss, take profit or order price to the values they already have. MetaQuotes lists it among the checks for Market products ("Sending a request to modify the levels without actually changing them"). In MQL4 the same mistake returned error 1.
Common causes
- A trailing or break-even routine that sends the modification on every tick, even when the level did not move.
- Comparing an unnormalised computed price with the stored one, so they look different but round to the same value.
- Code that "re-applies" stops after a restart without reading the current ones.
A real scenario
A break-even routine moves the stop to the open price once the trade is 20 pips in profit, and then keeps sending the same modification on every tick. Each one returns 10025, and the flood of identical requests later triggers 10024 on the broker's side. Comparing the normalised new level with the current one before sending removed both.
How to fix it
- Normalise the new levels to the symbol's digits.
- Compare them with the position's current
POSITION_SLandPOSITION_TP; if both are equal within half a point, send nothing. - Treat "nothing to change" as success in your own code.
Fixed MQL5 code
#include <Trade/Trade.mqh>
CTrade trade;
bool ModifyIfChanged(const ulong ticket, double sl, double tp)
{
if(!PositionSelectByTicket(ticket))
return false;
sl = NormalizeDouble(sl, _Digits);
tp = NormalizeDouble(tp, _Digits);
double half = _Point / 2.0;
bool slSame = MathAbs(sl - PositionGetDouble(POSITION_SL)) < half;
bool tpSame = MathAbs(tp - PositionGetDouble(POSITION_TP)) < half;
if(slSame && tpSame)
return true; // nothing to change: do not send a request
return trade.PositionModify(ticket, sl, tp);
}
A focused example for MetaTrader 5: adapt names, magic number and limits to your EA, and test it on a demo account first.
Related codes
- 10024Too Frequent RequestsTRADE_RETCODE_TOO_MANY_REQUESTSToo frequent requests: the EA sends faster than the server allows
- 10016Invalid StopsTRADE_RETCODE_INVALID_STOPSInvalid stops: SL or TP too close to the price or on the wrong side
EA Doctor rules that catch it
- MediumChanges near the price without the freeze level checkThe EA modifies stops or deletes orders without reading the freeze level, inside which the broker refuses changes with 10029.
Sources
Get your EA fixed
Still failing with 10025? Send us the EA and the journal lines: we find the cause in the code and fix it. Or check it yourself first with the EA Doctor.