Can you see the error -> I gcan't modify the take profit

 

Hi,

if(OrderType()==OP_BUY)
{  
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*TrailingStop_long,OrderOpenPrice()+Point*Profit,0,Yellow);
}  
if(OrderType()==OP_SELL)
{                                                                                      
  OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point*TrailingStop_short+spread,OrderOpenPrice()-Point*Profit,0,Yellow);
}
      

When I have a sell position, I can change the TP and the SL with the code above, but when I have a buy position, only the TS is changing, the SL is always 0.00.

I can't understand why.

 

what error u get ? also c MarketInfo(Symbol(), MODE_STOPLEVEL)

 

Thank you, I handled it with

if(OrderStopLoss()<Bid-Point*TS_berechnet_l && (OrderStopLoss()-(OrderOpenPrice()-Point*TS_berechnet_l))>Point)
  {              
    OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*TS_berechnet_l,OrderOpenPrice()  +Point*Profit,0,Yellow);   
  }

But now I am getting the OrderModify error 130

Can anybody tell me, what additional limitation do I have to write to avoid the OrderModify error 130.

 

Can't move stops closer than MarketInfo(Symbol(), MODE_STOPLEVEL)*Point (usually 3 pips)

What is TS_berechnet_l and did you adjust it for 5 digit brokers

//++++ These are adjusted for 5 digit brokers.
double  pips2points,    // slippage  3 pips    3=points    30=points
        pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int     init(){
    if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
 

Thany you for tipp:

Now I tested my OrderModify in this way:

          if(OrderStopLoss()<Bid-pips2dbl*TS_berechnet_l && (OrderStopLoss()-(OrderOpenPrice()-pips2dbl*TS_berechnet_l))>  MarketInfo(Symbol(), MODE_STOPLEVEL)*pips2dbl)
           {              
             OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-pips2dbl*TS_berechnet_l,OrderOpenPrice()+pips2dbl*Profit,0,Yellow);             
             return;
            }

But I am allways getting the

OrderModify error 130