Download MetaTrader 5

Error 130 modifying order on ECN broker

To add comments, please log in or register
filipefr
58
filipefr  

I'm trying to modify an order, but I'm getting error 130. I already checked for STOP LEVEL and it is 0 (I'm using Alpari). This is my code:

 

int digits= MarketInfo(Symbol(),MODE_DIGITS);
if(digits == 2|| digits == 3) pipdigits = 0.01;
else if(digits==4 || digits==5) pipdigits=0.0001;

selltakeprofit = Ask + (takeprofit*pipdigits);
sellstoploss = Ask - (stoploss*pipdigits);

ticket=OrderSend(Symbol(),OP_SELL,lotsize,Ask,100, 0,0,0,0,0,CLR_NONE);
if(ticket<0)
    {
       Print("venda Order send failed with error #",GetLastError());
       Print("stop loss = ", sellstoploss);

    }
else
    {

       Print("Order send sucesso!!");
       Print("Balancde = ", AccountBalance());
       Print("Equity = ", AccountEquity());   
       bool res;           
       res = OrderModify(ticket, 0, sellstoploss, selltakeprofit, 0);

       if(res == false)
         {
             Print("Error modifying order!, error#", GetLastError());
             Print("sellstoploss ", sellstoploss);
             Print("selltakeprofit ", selltakeprofit);
             Print("StopLevel ", StopLevel);
            Print("Ask ", Ask); 
         }
      else
        {
             Print("Order modified successfully");
        } 

 

} 

Keith Watford
Moderator
10615
Keith Watford  
selltakeprofit = Ask + (takeprofit*pipdigits);
sellstoploss = Ask - (stoploss*pipdigits);

 Take profit for a sell must be below the order open price

Vice versa for Stoploss 

whroeder1
16096
whroeder1  
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. and what GumRai said
To add comments, please log in or register