OrderModify() - need some help please

Back to topics list To post a new topic, please log in or register
avatar
14
FXBulldog 2015.03.27 10:30
 

I am trying to modify an order that is current/open.  To keep the changes that I want to make very simple at this stage (I am just trying to get the code right) all that i am attempting to do is find the order and then change the arrow colour to blue, but I get an OrderModify error code 4109.

 

Anyone spot where I am making the error in the code? 

 

 

avatar
14
FXBulldog 2015.03.27 10:31 #
 
 int    i,Pos,Error;
   int    Total=OrdersTotal();
   
   if(Total>0)
   {for(i=Total-1; i>=0; i--) 
     {if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == TRUE && OrderMagicNumber()==39379)
       { 
       bool res=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderTakeProfit(),0,Blue);}
            if(!res)
               Print("Error in OrderModify. Error code=",GetLastError());
            else
               Print("Order modified successfully.");

avatar
12
clausdp 2015.03.27 10:55 #
 

Error 4109 = "Trade is not allowed in expert properties"

You need to enable checkbox "Allow live trading" in the expert properties. 

avatar
14
FXBulldog 2015.03.27 12:17 #
 
Yes, but Live trading is active.  But perhaps this means the trade does not work on a practice account...  Does the code look OK to you?
Back to topics list  

To add comments, please log in or register