Page 1 of 1

Error 129 and the stale-tick bug in homemade EAs

Posted: Sat Oct 31, 2026 2:16 pm
by Amanhasnoname
Error 129, invalid price, usually points to a bug rather than a market event. The EA sends an order with a price that does not match the current market: a buy at a price that is not the current ask, or a price with the wrong number of digits.

The common source is reading price variables that are not refreshed. In MQL4, Bid and Ask hold the last known values, but inside a long calculation or after a sleep, they may be outdated. A market order sent with an old price gets rejected, or on instant execution accounts, requoted.

Digits are the other culprit. A symbol with five digits needs prices rounded to five decimals. Floating-point arithmetic can produce values like 1.085000000001, which is not valid. Normalizing the price before sending avoids the issue.

Resetting rates with the refresh function before each order, and normalizing every price, eliminates most 129 errors.

Seeing this error repeatedly is a sign that the code deserves a review rather than a retry loop.

Does the EA normalize and refresh prices before every order?