OrderModify Error 1 Mql4

 

Hi guys,

When I run my EA I have this error (OrderModify Error 1).

Also there are some trades that get closed before they could be modified.

So that you have an idea, TP and ST are at 30 pips (5 decimals broker) wich means 3 dolars of profit or loss. (0.01 Lots).

When the price just reach 2.90, OrderModify should work.


I apologize considering that this topic has been published many times. Your help is always welcome.

Thanks

for (i=0;i<OrdersTotal();i++) 
    if (OrderSelect(0,SELECT_BY_POS,MODE_TRADES));
    
    
     if(OrderType()==OP_BUY)
     if(OrderProfit()==2.90)    
     
         { 
          fm = OrderModify(OrderTicket(),Ask,Ask-StopLoss*Point,Ask+TakeProfit*Point,0,Green);
         } 
                  
      
      if(OrderType()==OP_SELL)      
      if(OrderProfit()==2.90)      
      
        {
         fm = OrderModify(OrderTicket(),Bid,Bid+StopLoss*Point,Bid-TakeProfit*Point,0,Red);
        }
       
       
      
    return;
    
   }

Thanks!

 
SalgadoCapital:

Hi guys,

When I run my EA I have this error (OrderModify Error 1).

Also there are some trades that get closed before they could be modified.

So that you have an idea, TP and ST are at 30 pips (5 decimals broker) wich means 3 dolars of profit or loss. (0.01 Lots).

When the price just reach 2.90, OrderModify should work.


I apologize considering that this topic has been published many times. Your help is always welcome.

Thanks

Thanks!

That is not actually an error but will fill your log file if you do not clean your code up ...

That only means that nothing would have changed (nether stop loss not take profit). Do a check before order modify if there is actually something going to be changed in the order if you attempt order modify with your new stop loss and / or take profit


As of closing : check your EA along with the above described code adjustments that you have to make in order to avoid "error 1"

 
Mladen Rakic:

That is not actually an error but will fill your log file if you do not clean your code up ...

That only means that nothing would have changed (nether stop loss not take profit). Do a check before order modify if there is actually something going to be changed in the order if you attempt order modify with your new stop loss and / or take profit


As of closing : check your EA along with the above described code adjustments that you have to make in order to avoid "error 1"

Hello

Thank you for your post.I also face this error sometime.

  • Above code is a must to face ERROR 1. 
  • Because first time when price meet 2.9 it can work with no error. 
  • As market move up..down..in the second time OrderStoploss ()== newstoploss so result of OrderModify will be no changed.. mean ERROR 1. 

However in my code i check it before (newStoploss-OrderStoploss()>50 pip)  but also face this error some time.

So I hope to know more detail if have.

CHAIYA

 
Chaiya Srisawat:

Hello

Thank you for your post.I also face this error sometime.

  • Above code is a must to face ERROR 1. 
  • Because first time when price meet 2.9 it can work with no error. 
  • As market move up..down..in the second time OrderStoploss ()== newstoploss so result of OrderModify will be no changed.. mean ERROR 1. 

However in my code i check it before (newStoploss-OrderStoploss()>50 pip)  but also face this error some time.

So I hope to know more detail if have.

CHAIYA

Simply check if the stop loss and / or take profit that you are going to try to apply are different from the already applied on that order- if not, then there is no need whatsoever to do an order modify (that would not change anything) and then to get error 1 (ie: nothing would change with that "modification")
Basic Principles - Trading Operations - MetaTrader 5 Help
Basic Principles - Trading Operations - MetaTrader 5 Help
  • www.metatrader5.com
is an instruction given to a broker to buy or sell a financial instrument. There are two main types of orders: Market and Pending. In addition, there are special Take Profit and Stop Loss levels. is the commercial exchange (buying or selling) of a financial security. Buying is executed at the demand price (Ask), and Sell is performed at the...
 
SalgadoCapital: When I run my EA I have this error (OrderModify Error 1).
ERR_NO_RESULT:
You Server
Change the SL to XIt is at X!
Change the SL to X It is at X!
Change the SL to XYou are insane
 
William Roeder:
ERR_NO_RESULT:
You Server
Change the SL to XIt is at X!
Change the SL to X It is at X!
Change the SL to XYou are insane
William Roeder.... Your answers are always foolish. If you want to help do it and stop abusing people 
 
Disagree. I explained what poster's code is doing. He should be able to change his (not posted) code. Where is your help?
Reason: