Download MetaTrader 5

let old EA work on Build 600+ on MT4

To add comments, please log in or register
Vivek Vyas
217
Vivek Vyas  

 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
Moderator
2296
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

Vivek Vyas
217
Vivek Vyas  
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
217
Vivek Vyas  
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
Moderator
2296
honest_knave  
{
    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
217
Vivek Vyas  
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