Errors, bugs, questions - page 304

 
Yedelkin:

I take this function from MQL5 Reference / Language Basics / Functions

But the compiler prints '(' - semicolon is expected

What does it mean?

I have checked it using the example from the edit (replacing the first passed parameter). everything is OK, no errors occured.

The correct help example looks like this

//function linfunc
double linfunc(double a, double b)
{
return(a + b);
}

I could get such a message like yours personally only in one test, when I replaced the first curly bracket with a round one. Then I got this message

'(' - semicolon is expected

If the number of parentheses (right and left) does not match, the following warning is generated

';' - unexpected token
'}' - semicolon is expected

PS

If I try to compile the current example (with a Russian "a") the compiler generates an error like it should

'a' - undeclared identifier

 
Yedelkin:

Don't make up things for others that aren't there :) The symbol was fixed right away in the editor, as a matter of course. The error occurs when the cursor is in front of the opening parenthesis, not before the 'a' character. Being humanly attentive, you should have noticed it in the quoted compiler comment.

The question remains: https://www.mql5.com/ru/forum/1111/page304#comment_48136

Explanation. The question has arisen, not because I am sitting down and stupidly compiling examples from the reference book, but because this error message appears when I create a working function. Referencing the example from the reference does not change anything. You can even remove the description of arguments from the header - the problem persists.

Yes he has an error, most likely unrelated to this example....

You need to look at the whole code...

 
Yedelkin:

I take this function from MQL5 Reference / Language Basics / Functions

But the compiler prints '(' - semicolon is expected

What does it mean?

We fixed the letter in the example, but we couldn't get this exact error. Can you provide the full code so that we can reproduce it?
 
Rosh:
The letter in the example has been fixed, but that's the exact error we couldn't get. Can you provide the full code so we can reproduce?

Thank you all for your attention to the question! The thing is, there is no "complete code" that could initiate an error. I just decided to check the statement from a C++ textbook that the value of an external variable, which is passed to a function as an argument, cannot be changed by the function (or something like that - well, from the field of self-education). I created a primitive function to check - the compiler generates an error. I referred to the reference, copied the example, corrected the symbol in the example - still the same error. I have tried to insert the function into a script template and in the Expert Advisor template, the error does not change. In fact, the "complete code" consists only of the function from the example, which has been inserted in the empty body of the onTick() or onStart() function.

I'll post such pseudo-complete code in the evening, but I don't know if it helps. I'll also try to overload the computer, since it's been used in "go to sleep and back" mode for a week.

 
Rosh:
The letter in the example has been corrected, but it was not possible to get this exact error. Can you provide the full code so we can reproduce?
void OnStart()
  {
   double                       // тип возвращаемого значения
   linfunc (double a, double b)  // имя функции и список параметров
     {
                               // составной оператор
      return (a + b);           // возвращаемое значение
     }
  }
It reproduces somehow like this.
 
Swan:
Somehow this is reproduced like this.

Well, you are trying to define one function within another - this is unacceptable. The function call section tells you this explicitly:

A function can be declared or described anywhere in the program globally, i.e., outside of other functions. A function cannot be declared or described within another function.

 
Rosh:

Well, you are trying to define one function within another - this is unacceptable. The function call section says this explicitly:

Thanks for the clarification! Exactly my case.

Theoretical knowledge does not guarantee the correctness of its application in practice :) My mistake.

 

Build 392.

When deleting a chart, it doesn't appear in the deleted list. It turns out that the File>Open Deleted menu item doesn't work.

Accidentally closed (instead of unfolding) the chart, hoping to see it in the deleted ones, and then ...

 
Ashes:

Build 392.

When deleting a chart, it doesn't appear in the deleted list. It turns out that the File>Open Deleted menu item doesn't work.

Accidentally closed (instead of unfolding) the chart, hoping to see it in the deleted ones, and then ...

Check the box.


 

Some agents won't start remotely, here's the log:

LE      0       5.0.6.84        14:51:19        login (build 392)
HN      2       Tester  14:51:20        initial synchronization error
JF      2       5.0.6.84        14:51:20        send error 10038
LJ      0       Tester  14:51:20        tester agent shutdown
KO      0       5.0.6.84        15:25:41        login (build 392)
HD      2       Tester  15:25:42        initial synchronization error
NM      0       Tester  15:25:42        tester agent shutdown
HM      0       127.0.0.1       15:36:37        login (build 392)
FK      0       Network 15:36:38        2548 bytes of optimization passes loaded
HM      0       Network 15:36:38        16 bytes of input parameters loaded
HE      0       Network 15:36:38        3788 bytes of group info loaded
GP      0       Network 15:36:38        3358 bytes of tester parameters loaded
HG      0       Network 15:36:38        2948 bytes of input parameters loaded
KL      0       Network 15:36:38        671 bytes of selected symbols loaded
CD      0       Tester  15:36:38        expert file added: Experts\MyExperts\ExpCrossEMA.ex5. 133395 bytes loaded
QS      0       Tester  15:36:38        initial deposit 5000.00 USD, leverage 1:100
PJ      0       Tester  15:36:38        successfully initialized
NP      0       Network 15:36:38        146 Kb of total initialization data received
MG      0       Tester  15:36:38        optimization pass 393 started
LR      0       TesterAgent     15:36:38        Intel Core2 Duo  E8200 @ 2.66 GHz, 2047 MB, PR49
DI      0       Symbols 15:36:40        EURUSD: symbol synchronized, 2904 bytes of symbol info received
QS      0       History 15:36:40        EURUSD: load 704 Kb of history data to synchronize
OF      0       History 15:36:40        EURUSD: history synchronized from 2009.01.02 to 2011.01.31
KK      0       History 15:36:42        EURUSD: contains 366322 M1 records of beginning data from 2009.01.02 10:00 to 2009.12.31 18:59
CH      0       History 15:36:42        EURUSD,M5: history cache reserved for estimated 150171 bars
JO      0       History 15:36:42        EURUSD,M5: history begins from 2009.01.02 10:00
NK      0       Tester  15:36:42        EURUSD,M5 (Alpari-Demo): every tick generating
KS      0       Tester  15:36:42        EURUSD,M5: testing of Experts\MyExperts\ExpCrossEMA.ex5 from 2010.01.01 00:00 to 2011.01.01 00:00 started with inputs:
PN      0       Tester  15:36:42          Inp_Signal_CrossEMA_FastPeriod=30
GG      0       Tester  15:36:42          Inp_Signal_CrossEMA_SlowPeriod=18
DS      0       Tester  15:36:42          Inp_Expert_Title=ExpCrossEMA
MK      0       Tester  15:36:42          Inp_Money_FixLot_Percent=10
FM      0       Tester  15:36:42          Inp_Money_FixLot_Lots=0.1
GO      0       ExpCrossEMA (EURUSD,M5) 15:36:42        2010.01.01 00:00:00   CSignalCrossEMA::ValidationSettings: period of slow EMA must be greater than period of fast EMA
RF      0       ExpCrossEMA (EURUSD,M5) 15:36:42        2010.01.01 00:00:00   OnInit: error signal parameters
DM      2       Tester  15:36:42        tester stopped because OnInit failed
FG      0       Network 15:36:42        16 bytes of tester parameters received
PR      0       Tester  15:36:42        optimization pass 1817 started
FK      0       Tester  15:36:42        initial deposit 5000.00 USD, leverage 1:100
FL      0       Tester  15:36:44        EURUSD,M5 (Alpari-Demo): every tick generating
GE      0       Tester  15:36:44        EURUSD,M5: testing of Experts\MyExperts\ExpCrossEMA.ex5 from 2010.01.01 00:00 to 2011.01.01 00:00 started with inputs:
GE      0       Tester  15:36:44          Inp_Signal_CrossEMA_FastPeriod=28
KM      0       Tester  15:36:44          Inp_Signal_CrossEMA_SlowPeriod=49
DJ      0       Tester  15:36:44          Inp_Expert_Title=ExpCrossEMA
IM      0       Tester  15:36:44          Inp_Money_FixLot_Percent=10
RF      0       Tester  15:36:44          Inp_Money_FixLot_Lots=0.1
GO      0       Tester  15:36:45        output to log disabled
IO      0       Tester  15:37:10        OnTester result 0

Although via localhost this agent works locally.

What could be the reason?

Reason: