help needed

 
hi. I wrote the code and it was good. but somehow now there is a warning about the "OrderModify" and I can't find the problem. it writes "return value of 'OrderModify' should be checked". does someone know what this means?
 
if (Bid>takeprofit2-20*Point&&Bid<takeprofit2+20*Point&&o==0)
{
for(int i=OrdersTotal()-1;i>=0;i--)
{
for(int j=i;j>=0;j--)
{
if(OrderSelect(i, SELECT_BY_POS))
{
o=2;
ticket=OrderTicket();
openprice=OrderOpenPrice();
takeprofit=OrderTakeProfit();
OrderModify(ticket,openprice,openprice+2*spread,takeprofit,0,Red);
 

https://www.mql5.com/en/forum/139592

and

https://docs.mql4.com/en/trading/ordermodify

Returned value (OrderModify)

If the function succeeds, it returns true, otherwise false.

 
thanks. I know that. but it was o.k before and I haven't changed nothing. and now all my programs have this problem. maybe it's because the mt4 had been updated?
 

You aren't checking the return value of OrderModify in your last line of code. That is why you are get the warning.

To put it another way, MT4 wants you to check if the OrderModify function returns true or false rather than just blindly running it.

MT4 is now more strict and alerts you to this bad style as a warning (not an error).

if(OrderModify(ticket,openprice,openprice+2*spread,takeprofit,0,Red)) {/*do something*/} else {/*do something else*/}
 

is it new?

 
roeysegal:

is it new?


yes
 
thank you very much. it works :)
 
it doesn't modify. why? no error.
 
roeysegal:
it doesn't modify. why? no error.

Use Print() so that it produce output in case it doesn't modify.
 

I used Print() and it returns nothing.

if(Bid>takeprofit2-20*Point && Bid<takeprofit2+20*Point && o==0)
  {
   Print("1");
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      for(int j=i;j>=0;j--)
        {
         if(OrderSelect(i,SELECT_BY_POS))
           {
            Print("2");
            o=2;
            ticket=OrderTicket();
            openprice=OrderOpenPrice();
            takeprofit=OrderTakeProfit();
            if(OrderModify(ticket,openprice,openprice+2*spread,takeprofit,0,Red))
               Print("3");
           }
        }
     }
  }
"o" is changed to 0 when all positions are closed.

takeprofit2 is at least 40-50 pips from OpenPrice(). and it gets there, but doesn't enter. it doesn't return "1".

what more can I do?