Errors, bugs, questions - page 847

 

The compiler expressed something in English to me. Bracket something is not a program, the program in general is wrong with this bracket and the bracket is unbalanced. But there are brackets. Could you please tell me where to look for an error?

'}' - Error at the end of program Redo.mq5 3562 1
'{' - unbalanced parentheses Redo.mq5 3330 1

//////////////////////////////////////////////////////////////////////////////////////////////

int waitIfBusy() 
{   
   for (int Yx = 0;  MQL5InfoInteger(MQL5_TRADE_ALLOWED) && Yx < 50; Yx++) Sleep(125);   
   if (Yx >= 50) Print("Торговый поток занят больше ", DoubleToString(25 * Yx / 1000, 2), " секунд");
   else if (Yx > 0) Print("Торговый поток был занят ", DoubleToString(25 * Yx / 1000, 2), " секунд");   
   return (Yx);   
} 

//////////////////////////////////////////////////////////////////////////////////////////////
 
I believe the problem is higher up--this way I look at it, it's all right...
 
Yedelkin:

Well, I've already finished it above. Let me repeat: the "new" quote for the Expert Advisor is a quote that arrives right after the completion of the next OnTick() function, even if this quote is not the "first tick on the bar". Your condition of a new bar coming

will be checked only after the Expert Advisor finishes the processing of the quote that came on the "previous" bar. ...If the OnTick() function is executed for 90 seconds and started at 00.00.00, the "condition for a new tick on M1 will be executed at least once, namely after 00.01.30

Thanks, that's how it should be.
 
Dimka-novitsek:

The compiler expressed something in English to me. Bracket something is not a program, the program in general is wrong with this bracket and the bracket is unbalanced. But there are brackets. Please, tell me, where to look for an error?

'}' - unexpected end of program Redo.mq5 3562 1
'{' - unbalanced parentheses Remake.mq5 3330 1

Maybe braces are missing when writing code (regardless of what the compiler says)?

int waitIfBusy() 
{   
   for (int Yx = 0;  MQL5InfoInteger(MQL5_TRADE_ALLOWED) && Yx < 50; Yx++) 
   {
    Sleep(125);   
   if (Yx >= 50) Print("Торговый поток занят больше ", DoubleToString(25 * Yx / 1000, 2), " секунд");
   else 
     if (Yx > 0) Print("Торговый поток был занят ", DoubleToString(25 * Yx / 1000, 2), " секунд");   
   return (Yx);   
   }
}
 
Thank you!!!
 
I'm sorry, same question. It says '{' - some operator expected parenthesis.mq5 612 62 I've been trying it for about 20-25 minutes in a separate EA and I can't find the reason.
/////////////////////////////////////////////////////////////////////// 

bool OrderClose(string Symb)
  {



    PositionSelect(Symb);  Print("Start@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");

   long PositionID=0;
    PositionID=PositionGetInteger(POSITION_IDENTIFIER);//Идентификатор позиции - это уникальное число, которое присваивается каждой вновь открытой позиции и не изменяется в течение всей ее жизни. Переворот позиции не изменяет идентификатора позиции.

     Print("PositionID");
    Print(PositionID);
   HistorySelect(
                 TimeCurrent()-(60*60*24*7*4),// с даты
                 TimeCurrent() // по дату
                 );

     for(int i=0; HistoryDealsTotal()>i; i++) 
   
     {
      ulong TicetSdelki;
      TicetSdelki=
                  HistoryDealGetTicket(
                  i        // номер сделки
                 );

                   long  HistoryID=HistoryDealGetInteger(
                  TicetSdelki,// тикет
      DEAL_POSITION_ID          // идентификатор свойства
      );                          //Идентификатор позиции, в открытии, изменении или закрытии которой участвовала эта сделка. Каждая позиция имеет уникальный идентификатор, который присваивается всем сделкам, совершенным на инструменте в течение всей жизни позиции.

                                  // Print ( i ); Print ( "HistoryID" ); Print ( HistoryID ); 
      if(HistoryID!=0 && PositionID!=0 && PositionID==HistoryID)
        {
         ulong TicetTojSdelki; TicetTojSdelki=TicetSdelki;

         string TYP="";
         if(HistoryDealGetInteger(TicetTojSdelki,DEAL_TYPE)==DEAL_TYPE_BUY){ TYP="OP_SELL";}
         if(HistoryDealGetInteger(TicetTojSdelki,DEAL_TYPE)==DEAL_TYPE_SELL){ TYP="OP_BUY";}
         ulong resultat=OrderSendSELLi(Symbol(),TYP,HistoryDealGetDouble(TicetTojSdelki,DEAL_VOLUME),10,10,
                                       ASK(Symbol())+300 *SymbolInfoDouble(Symbol(),SYMBOL_POINT),BID(Symbol())-300 *SymbolInfoDouble(Symbol(),SYMBOL_POINT)," com ",600,600,0);
       
         if(resultat==10009)return true;else  return false;

           }

    }



  }
//+------------------------------------------------------------------+
I looked through them 6 times p-pairwise, they all seem to be paired. And they are not so dark, not so many. I'm looking at everything, dots with dots, other brackets... Take a look, please, if you can!
 
Dimka-novitsek:
Sorry, same question. It says '{' - some operator expected parenthesis.mq5 612 62 I try it for about 20-25 minutes or maybe more in a separate EA and I can not find the cause, all the large brackets I have seen 6 times, all paired. And they are not so dark, not so many. I'm looking at everything, dots with dots, other brackets... Take a look, please, if you can!

In order to make the code understandable not only for you but for everyone else, there is a very useful feature in the MetaEditor. It's called the Styler (follow this link for details). Click Tools => Styler. Shortcut Ctrl+, . Try it and it will help you to understand it. ))

 
Yes, right away, sorry.
 
/////////////////////////////////////////////////////////////////////// 

bool OrderClose(string Symb)


{



    PositionSelect(Symb);  Print("Start@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");

   long PositionID=0;
    PositionID=PositionGetInteger(POSITION_IDENTIFIER);//Идентификатор позиции - это уникальное число, которое присваивается каждой вновь открытой позиции и не изменяется в течение всей ее жизни. Переворот позиции не изменяет идентификатора позиции.

     Print("PositionID");
    Print(PositionID);
   HistorySelect(
                 TimeCurrent()-(60*60*24*7*4),// с даты
                 TimeCurrent() // по дату
                 );

     for(int i=0; HistoryDealsTotal()>i; i++) 
   
     {
                     ulong TicetSdelki;
                     TicetSdelki=
                     HistoryDealGetTicket(
                     i        // номер сделки
                     );

                     long  HistoryID=HistoryDealGetInteger(
                     TicetSdelki,// тикет
                     DEAL_POSITION_ID          // идентификатор свойства
                     );                          //Идентификатор позиции, в открытии, изменении или закрытии которой участвовала эта сделка. Каждая позиция имеет уникальный идентификатор, который присваивается всем сделкам, совершенным на инструменте в течение всей жизни позиции.

                                  // Print ( i ); Print ( "HistoryID" ); Print ( HistoryID ); 
                if(HistoryID!=0 && PositionID!=0 && PositionID==HistoryID)
                {
                            ulong TicetTojSdelki; TicetTojSdelki=TicetSdelki;
                            string TYP="";
                            if(HistoryDealGetInteger(TicetTojSdelki,DEAL_TYPE)==DEAL_TYPE_BUY){ TYP="OP_SELL";}
                            if(HistoryDealGetInteger(TicetTojSdelki,DEAL_TYPE)==DEAL_TYPE_SELL){ TYP="OP_BUY";}
                            ulong resultat=OrderSendSELLi(Symbol(),TYP,HistoryDealGetDouble(TicetTojSdelki,DEAL_VOLUME),10,10,
                            ASK(Symbol())+300 *SymbolInfoDouble(Symbol(),SYMBOL_POINT),BID(Symbol())-300 *SymbolInfoDouble(Symbol(),SYMBOL_POINT)," com ",600,600,0);
       
                            if(resultat==10009)return true;else  return false;

                }

    }



}
//+------------------------------------------------------------------+
There are only three pairs of basic brackets
 
Dimka-novitsek:
There are only three pairs of parentheses

The compiler points out the line it tripped over. Next time you should highlight such lines. It's a pain in the ass to search for "line 612 and cursor position 62".

On this line.

if(resultat==10009)return true;else  return false;

I don't like that true and false aren't surrounded by parentheses. I don't know if the language allows it, but this is how it should be written in fen-shui:

if(resultat==10009) 
    return(true);
else  
    return(false); 
Reason: