Download MetaTrader 5
To add comments, please log in or register
Find out how to install MetaTrader on Mac OS
Vivek Vyas
203
Vivek Vyas 2014.06.27 17:49 
Request to solve warning error in the code please provide a solution of the error !!
 {
        OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
        if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 2)
        {
            continue;
        }
        ordticket[orders][0] = OrderOpenTime();
        ordticket[orders][1] = OrderTicket();
        orders++;
    }
  {
        OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
        if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1)
        {
            continue;
        }
        ordticket[orders][0] = OrderOpenTime();
        ordticket[orders][1] = OrderTicket();
        orders++;
    }
 {
        OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
        if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 2)
        {
            continue;
        }
        ordticket[orders][0] = OrderOpenTime();
        ordticket[orders][1] = OrderTicket();
        orders++;
    }
 {
        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(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(ticket2, SELECT_BY_TICKET);
                        bool ret4 = OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0, White);
                        if (ret4 == false)
                        Print("OrderModify() error - ", ErrorDescription(GetLastError()));
                    }
 {
                        OrderSelect(ticket, SELECT_BY_TICKET);
                        bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0, White);
                        if (ret == false)
                        Print("OrderModify() error - ", ErrorDescription(GetLastError()));
                    }
 {
            OrderSelect(ticket, SELECT_BY_TICKET);
            bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red);
            if (ret == false)
            Print("OrderModify() error - ", ErrorDescription(GetLastError()));
        }
          
 {
            OrderSelect(ticket, SELECT_BY_TICKET);
            bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red);
            if (ret == false)
            Print("OrderModify() error - ", ErrorDescription(GetLastError()));
        }
  {
                        OrderSelect(ticket2, SELECT_BY_TICKET);
                        bool ret4 = OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0, White);
                        if (ret4 == false)
                        Print("OrderModify() error - ", ErrorDescription(GetLastError()));
                    }
 {
                        OrderSelect(ticket, SELECT_BY_TICKET);
                        bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0, White);
                        if (ret == false)
                        Print("OrderModify() error - ", ErrorDescription(GetLastError()));
                    }
   {
            OrderSelect(ticket, SELECT_BY_TICKET);
            bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
            if (ret == false)
            Print("OrderModify() error - ", ErrorDescription(GetLastError()));
        }
  {
            OrderSelect(ticket, SELECT_BY_TICKET);
            bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
            if (ret == false)
            Print("OrderModify() error - ", ErrorDescription(GetLastError()));
        }
honest_knave
970
honest_knave 2014.06.27 18:40  
debar
4
debar 2014.06.27 19:02  
expertarts:
Request to solve warning error in the code please provide a solution of the error !!


You don't check if OrderSelect is successful, or not.

Replace:

OrderSelect(ticket, SELECT_BY_TICKET); 

by: 

if ( OrderSelect(OrderPosition, SELECT_BY_TICKET)){continue;} 

or by:  

if ( ! OrderSelect(OrderPosition, SELECT_BY_TICKET)){return;}  
Vivek Vyas
203
Vivek Vyas 2014.06.28 07:17  

Hi debar

I use software which use block diagrams to make EA !! It works fine with MT4 previous build but now I want to compile an EA for MT4 build 600+ n it doesn't recognise those errors so i have to edit in code,as I am not a programmer so even if its a minor error I am unable to solve,that must be fine.

Now please help with another error evolved after replacing with as you guided the error says

"empty controlled statement found"

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

 


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

Keith Watford
Moderator
8017
Keith Watford 2014.06.28 07:41  

expertarts:

 ow please help with another error evolved after replacing with as you guided the error says

"empty controlled statement found"


There is no code between the if( ) and the ;

That is the empty statement, remove the ; and you should be ok. 

 

if(OrderSelect(ticket, SELECT_BY_TICKET));
Vivek Vyas
203
Vivek Vyas 2014.06.28 08:27  
GumRai:

There is no code between the if( ) and the ;

That is the empty statement, remove the ; and you should be ok. 

 

 

Hi,Gumrai
Thank you very much !! error is resolved now;

Suggest any guide for updating code(ea) from MT4 previous builds to MT4 600+

 

Thanks once again!!!!!!!!!!!!!Cheers!!! 

/
To add comments, please log in or register