Download MetaTrader 5
To add comments, please log in or register
Use MQL5 Cloud Network. Test robots at a super speed!
Vivek Vyas
203
Vivek Vyas 2014.06.25 18:00 

 I want to work EA on Build 600+ on MT4 but unable to solve this two complilation error.If any coder can guide what to do in such case would be great help to move on...on this issue. 

1."not all control paths return a value"

2."return value of 'OrderSelect' should be checked"
honest_knave
969
honest_knave 2014.06.25 18:11  

Simple to fix, but you need to post your code if you want specifics on how to do it.

1. https://www.mql5.com/en/articles/1391#1_4

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

Vivek Vyas
203
Vivek Vyas 2014.06.25 18:13  
expertarts:

 I want to work EA on Build 600+ on MT4 but unable to solve this two complilation error.If any coder can guide what to do in such case would be great help to move on...on this issue. 

1."not all control paths return a value"

2."return value of 'OrderSelect' should be checked"

{
    NDigits = Digits;
    
    if (false) ObjectsDeleteAll();      // clear the chart
    
    
    Comment("");    // clear the chart
}

{
    if (Bars < 10)
    {
        Comment("Not enough bars");
        return (0);
    }
    if (Terminated == true)
    {
        Comment("EA Terminated.");
        return (0);
    }
    
    OnEveryTick11();
    
}

{
    if (false) ObjectsDeleteAll();
    
    
}


















  {
            OrderSelect(ticket, SELECT_BY_TICKET);
            bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
            if (ret == false)
            Print("OrderModify() error - ", ErrorDescription(GetLastError()));
        }




  {
        OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
        if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1)
        {
            continue;
        }
        ordticket[orders][0] = OrderOpenTime();
        ordticket[orders][1] = OrderTicket();
        orders++;
    }

{
                        OrderSelect(ticket, SELECT_BY_TICKET);
                        bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0, White);
                        if (ret == false)
                        Print("OrderModify() error - ", ErrorDescription(GetLastError()));
                    }









Vivek Vyas
203
Vivek Vyas 2014.06.25 18:21  
honest_knave:

Simple to fix, but you need to post your code if you want specifics on how to do it.

1. https://www.mql5.com/en/articles/1391#1_4

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

 


please check the code attached,suggest the possible error compiling.
honest_knave
969
honest_knave 2014.06.25 18:31  
{
    if (Bars < 10)
    {
        Comment("Not enough bars");
        return (0);
    }
    if (Terminated == true)
    {
        Comment("EA Terminated.");
        return (0);
    }
    
    OnEveryTick11();
    return(0);
}

 

 

{
            if(!OrderSelect(ticket,SELECT_BY_TICKET))
              {
                // do whatever you want to happen if the order select fails... print a message normally
              }


            bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
            if (ret == false)
            Print("OrderModify() error - ", ErrorDescription(GetLastError()));
        }




  {
        if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
          {
           // do whatever you want to happen if the order select fails... print a message normally
          }

        if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1)
        {
            continue;
        }
        ordticket[orders][0] = OrderOpenTime();
        ordticket[orders][1] = OrderTicket();
        orders++;
    }

{
                        if(!OrderSelect(ticket,SELECT_BY_TICKET))
                          {
                            // do whatever you want to happen if the order select fails... print a message normally
                          }

                        bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0, White);
                        if (ret == false)
                        Print("OrderModify() error - ", ErrorDescription(GetLastError()));
                    }
Vivek Vyas
203
Vivek Vyas 2014.06.26 08:53  
honest_knave:

 

 

 

 

Problem one is solve but 2."return value of 'OrderSelect' should be checked" still unsolved. 

/
To add comments, please log in or register