for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i, SELECT_BY_POS)) if(OrderMagicNumber() == MAGIC_NUMBER && OrderSymbol() == Symbol()) { iOrder_type=OrderType(); } else{ Print("MagicNumber or OrderSybol is wrong."); return false; }
This code means the EA in incompatible with with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 and MetaTrader 4 - MQL4 programming forum-
In the presence of multiple orders (one EA
multiple charts, multiple EAs, manual
trading,) while you are waiting for the current operation (closing, deleting,
modifying) to complete, any number of other operations on other orders could
have concurrently happened and changed the position indexing:
-
For non-FIFO (US brokers,) (or the EA only opens one order per symbol,) you
can simply count down in a position loop, and you won't miss
orders. Get in the habit of always counting down.
Loops and Closing or Deleting Orders - MQL4 and MetaTrader 4 - MQL4 programming forum
For FIFO (US brokers,) and you (potentially) process multiple orders per symbol, you must count up and on a successful operation, reprocess all positions (set index to -1 before continuing.) -
and check OrderSelect in case earlier positions were deleted.
What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles - and if you (potentially) process multiple orders, must call RefreshRates() after server calls if you want to use the Predefined Variables (Bid/Ask) or OrderClosePrice() instead, on the next order/server call.
-
For non-FIFO (US brokers,) (or the EA only opens one order per symbol,) you
can simply count down in a position loop, and you won't miss
orders. Get in the habit of always counting down.
- thomas2004: Error by OrderModify : 1ERR_NO_RESULT
You Server Change the SL to X It is at X! Change the SL to X It is at X! Change the SL to X You are insane
1 & 2.
Assumed I just use one EA for one chart and no any manual set order. In other words, there is only one order, long or short. Other case will not be consider now.
I do use the RefreshRates(). But I haven't posted in my code.
3.
"Change the SL to X"? I don't understand what your table tells.
thomas2004:
"Change the SL to X"? I don't understand what your table tells.
whroeder1 likes his templates that he spreads on this forum. He wanted to say by his table: If unchanged values are passed as the OrderModify parameters, the error 1 (ERR_NO_RESULT) will be generated.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
In my EA I use the trailing stop as follow:
But as I run the EA I got error message: CFDDAX,M5: Error by OrderModify : 1