Errors, bugs, questions - page 325

 
AlexSTAL:
Shit... The terminal comes with so many examples... ...so many examples... SymbolInfoSample.mq5 script, for example
Sometimes it's enough to define new concepts in the beginning. And only then examine the examples of programs.
 
How do I get the full path to include file?


There are two functions

__FILE__ - it gives only file name

MQL5_PROGRAM_PATH - it gives the path to the resulting ex5 file


Question - how do I know where in the mqh-file it is located?

 
In MetaEditor, the "List of functions in file" button opens the list. If you scroll down, it ends at P and does not move any further (the black triangle pointing down becomes inactive), although there are classes with the letter R as well. Please fix it.
 
-Alexey-:
In MetaEditor, the "List of functions in file" button opens the list. If you scroll down, it ends at P and does not move any further (black triangle pointing down becomes inactive), although there are classes at R as well. Please correct.

And at least approximate size of the list what? Maybe there is a limit to the size of the list...
 

I don't know if it's a bug or if I've found a trick. The following code works, but gives a warning expression is not boolean

void OnStart()
  {
//---
   int a=3;
   int b=3;
   int c=3;
//---   
   if(a=b=c=3)Alert("a=b=c=3");
   else Alert("Условие не верно");
//---
  }
 
sergey1294:

I don't know if it is a bug or a trick. The following code works but generates the expression is not boolean warning



Why shouldn't the code work?

The only thing is that the if operand is not converted to a bool, this is what the compiler warns about, but otherwise everything is correct.

a,b,c, by the way, can be not initialized at all, since they are explicitly assigned in the if.

3 assign to a, assign a to b, assign b to c and then check if it is true and then write Print().

Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Предупреждения компилятора
Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Предупреждения компилятора
  • www.mql5.com
Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Предупреждения компилятора - Документация по MQL5
 
sergey1294:

I don't know if it's a bug or if I've found a trick. The following code works, but gives a warning expression is not boolean


It's probably like this.

void OnStart()
{
//----------------------------------------------------------------------------//
//Work variables
int a=3;
int b=3;
int c=3;
//----------------------------------------------------------------------------//
  if(a&&b&&c==3)Alert("a=b=c=3");
  else Alert("Условие не верно");
//----------------------------------------------------------------------------//
}
 

Then tell me how to write this expression so it doesn't swear.

void OnStart()
  {
//---
   int a=1;
   int b=2;
   int c=3;
//---   
   if(a<b<c)Alert("a<b<c");
   else Alert("Условие не верно");
//---
  }
 
sergey1294:

Then tell me how to write this expression so it doesn't swear.


if(a<b&&b<c){Print("");}

In the first post you are doing assignment operations, multiple cascading assignment is acceptable. Here you are trying to do a multiple comparison.

SZ since you have two comparison results in your output they should be separated by && or other boolean operator.

 
sergey1294:

Then tell me how to write this expression so it doesn't swear.


I suggest the following.

//----------------------------------------------------------------------------//
//Work variables
int a=1;
int b=2;
int c=3;
//----------------------------------------------------------------------------//
  if(a<b&&b<c)Alert("a<b<c");
  else Alert("Условие не верно");
//----------------------------------------------------------------------------//

Nikolay is ahead of you :)

Urain:

SZY since you have two comparison results in your output, they should be separated by && or other boolean operator.

In this case only &&.
Reason: