change tp

 

hi

i want to change my orders tp when i want but i can't

what is my problem

these my codes

void change_tp()
{
int total=OrdersTotal();
if(total>0)
{
for(int pos=0;pos<total;pos++)
{
//if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)==false)
//continue;
//else
{OrderSelect(pos,SELECT_BY_POS,MODE_TRADES);
if(OrderType()==OP_BUY)
if((Ask-OrderOpenPrice())>=30*Point)
OrderModifyReliable(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-120*Point,OrderOpenPrice()+0*Point,0,0);
else if(OrderType()==OP_SELL)
if((OrderOpenPrice()-Bid)>=30*Point)
OrderModifyReliable(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+120*Point,OrderOpenPrice()+2*Point,0,0);
}
}
}
return(0);
}

 

what error u get

 

i tested it in strategy tester but it did not work and my tp did not change

what must i do?

 

put some Print() or Alert() to find out

 

what's this function?

OrderModifyReliable

if it's same as this (https://www.mql5.com/en/forum/129425) you should get some error logs