Errors, bugs, questions - page 2074

 

When using the indicator in the bottom window, auto scaling does not work correctly.

If two buffers are required in data window, but only first buffer participates in drawing, and second buffer has "DRAW_NONE" type - without drawing, scaling is performed by second buffer (values of second buffer are more than first one), although scaling should not be performed by it (type "DRAW_NONE").

The first buffer is accurate to 6 decimal places (for example - 0.0001249 AC indicator). The second buffer contains values -2, -1,0,1,2 (analogue - no, undefined, yes, etc.)

 
SEM:

When using the indicator in the bottom window, auto scaling does not work correctly.

If two buffers are required in data window, but only first buffer participates in drawing, and second buffer has "DRAW_NONE" type - without drawing, scaling is performed by second buffer (values of second buffer are more than first one), although scaling should not be performed by it (type "DRAW_NONE").

The first buffer is accurate to 6 decimal places (for example - 0.0001249 AC indicator). The second buffer contains values -2, -1,0,1,2 (analogue - no, undefined, yes, etc.)

Will fix in new build.
 

Why is the compiler silent?

enum   ENUM_FILTER      {off,zero,model,main,fast,slow,upper,lower};

void OnStart()
{

double zero=5;//Почему компилятор молчит?
int d=(ENUM_FILTER)model;
int e=(ENUM_FILTER)zero;
Print("d=",d," zero=",zero," e=",e);
}

2017.11.23 16:16:53.518 test EURCHF,H1: d=2 zero=5.0 e=5


Didn't we create named constants when declaring the enumeration and didn't the name "zero"=1 occupy the global level?
 
Kirill Belousov:

Why is the compiler silent?

For the same reason.

enum ENUM {i = 5};

void OnStart()
{
  int i = i + 1;
  
  Print(i);   // 6
  Print(::i); // 5
}
Use ::.
 
fxsaber:

For the same reason.

Use ::.

Thank you.

The :: enum works. And it works even if the enum is specified inside OnStart()

It's just that if it were a function, it would be understandable. It is also described in the help.

But zero here is an initialized constant. I thought these were different things.

That's why I asked - why doesn't the compiler generate a warning that the zero name is already used in the global context?

Where is it written in the help? Or is it undocumented?

 
Kirill Belousov:

Why doesn't the compiler generate a warning that zero is already being used in a global context.

Bug. If it were not an enum but a variable, it would generate "declaration of 'xxx' hides global declaration at line yyy". Write to the SD.

MQL5(4)-вопрос. Точка входа.
MQL5(4)-вопрос. Точка входа.
  • 2017.04.23
  • www.mql5.com
Всем привет. Приступил к изучению языка MQL5. Пока только прочитал "Основы языка" из документации...
 
Alexey Kozitsyn:
Will be fixed in the new build.
Thank you for the information!
 
fxsaber:

Flaw. If it were not an enum but a variable, it would return "declaration of 'xxx' hides global declaration at line yyy". Write to the SD.

I wrote it in SD.

And if we consider the case when an enum is inside OnStart().

It won't generate the warning either.

What does it have to do with context? Everything happens inside one function here...

It turns out that the constant names from enum are not checked for being occupied at all. They are replaced in the code before the checks. Does it seem so?
 
Kirill Belousov:

The SD has written.

And if we consider the case of enum inside OnStart().

It won't generate a warning message either.

What does it have to do with context? Everything happens inside one function here.

It turns out that constant names from enum are not checked for being occupied at all. They are replaced in the code before the checks. Does it look like that?

You have already written it in SD.

 

I am writing an EA,
when I enabled optimization in MT5, I get blue screen W10x64 b1653 repeatedly
may be someone has faced with this phenomenon?
What is the reason for it?

Reason: