If your EA keeps returning error 130, check which side of the price holds the stop before making it wider. In my native MT4 tester, a BUY stop at 1.2154 was rejected with error 130. The corrected stop at 1.1926 was accepted with error 0. The important change was where the stop belonged, not a new entry rule.
The price your EA should compare
A BUY opens at Ask, but its protective stop is checked against Bid. That can be easy to miss when your code uses the opening price for both jobs. In this saved EURUSD case, Bid was 1.2034 and Ask was 1.2054. The requested stop, 1.2154, was above both. Giving a BUY a protective exit above the current Bid did not describe the loss exit the program intended.
The tester rejected that request. The log records a ticket of -1 and error 130. I then changed the stop to 1.1926, below Bid. The corrected simulated BUY returned ticket 1 and error 0. I also read back the stop stored on that simulated order. It matched 1.1926. That last check matters: a clean return alone would leave open whether the program had submitted the price we meant.
Write down the request before changing it
When your own EA shows this error, save the symbol, order direction, requested opening price, stop, target, Bid and Ask beside the error. Keep the point size, tick size and stop-distance setting too. Otherwise a code change can appear to fix the error while quietly changing the rule you wanted to trade.
My saved case used a point size of 0.0001 and a stop-distance setting of 8 points. Those are properties of this particular offline tester environment. Copying its stop price into a different symbol would make little sense. Your EA needs to read the properties for the symbol named in its request, then compare prices in the right units.
I would first check direction. For a BUY, the protective stop belongs below Bid. For a SELL, it belongs above Ask. Then check the required distance and the permitted price increments. A correct-looking decimal can still sit between permitted prices. Increasing the distance before checking direction can hide the original mistake rather than explain it.
Keep the same intended trade
Do not change the entry rule, direction, position size and stop calculation together. You would no longer know which edit changed the result. In this case, I kept the BUY request and showed the rejected stop beside the corrected stop. The log then checked that the accepted simulated order stored the intended price.
I also closed the simulated order before the case ended. No account order was sent. This is useful when investigating an EA problem: the smallest safe case can show the price mistake without turning a debugging session into an unintended trade.
What you can check today
Find the request immediately before error 130 in your log. Put its stop beside the Bid or Ask used for that direction. Ask whether the stop describes the protective exit your written rule actually calls for. Then check distance and price increments for that symbol. Keep the rejected and corrected requests together so that a later edit cannot erase what happened.
The full case, source pattern and official price-distance references are on the canonical page. This run used an offline MT4 Strategy Tester with default settings; it does not establish acceptance by your broker or a profitable strategy.

Top comments (0)