Errors, bugs, questions - page 2751

 
Igor Makanu:

it's kind of a paradox that there is access to _Symbol .... but no access to

const MqlTick _Tick; // Текущий _Symbol-тик.

although MQL is positioned as a language for development of trading strategies

_Symbol is a constant, that's why there is no problem with it (though it's more correct to call Symbol()). A tick is a variable. How do you imagine it is declared as const, but its value changes?

 
Alexey Navoykov:

How is it that you have it declared as const, but its value changes.

Alas, I'm just like you... Same idealist, for whom it is more logical and understandable to write in VS C# - there the compiler does not allow to separate a logical concept of constant from the machine check of C++ before compilation

didn't hesitate to ask questions

https://www.mql5.com/ru/forum/1111/page2680#comment_15546412


gist - it's all logical in C++ ;)

 
Alexey Navoykov:

You don't need this ***. _Symbol is a constant, so there's no problem with it(although it's more correct to call Symbol()).

What's wrong with writing it for a user?

const string _Symbol = ::Symbol();

And a tick is a variable - how do you imagine it is declared as const, but its value changes.

Bid/Ask in MT4. Of course, RefreshRates() is there.


Just recently discovered a symbol on which Digits was incorrectly set. I asked my broker to correct it. He did it on the fly. Didn't look if changed value of variable _Digits and Digits(). But just the fact that the symbol can change its values on the fly.

 
Dear developers, is it possible to make the chart window look like other windows, like in WIN 10? Alternatively, there is a possibility to "repaint" the chart window frame, and the terminal frame in general, with black colour.
Depending on the colour scheme, for example. Wide white frames on black charts are annoying, irritating and prevent from getting rich. Please!!!
 
Igor Makanu:

Alas, I'm just like you... I am the same idealist who finds it more logical and understandable to write in VS C# - the compiler there does not allow to separate the logical notion of constant from the machine check of C++ before compilation

didn't hesitate to ask questions

https://www.mql5.com/ru/forum/1111/page2680#comment_15546412

In the first case you have a static variable, not a class member, so the constant has nothing to do with it.

 
Alexey Navoykov:

You don't need this ***. _Symbol is a constant, so there is no problem with it (although it's more correct to call Symbol()). A tick is a variable. How do you imagine that it is declared as const, but its value changes.

You mix up constancy from the MQL side and from the kernel side. The essence of declaring a structure with the const modifier is that the MQL code cannot modify it. By analogy, you can describe a method of class const, which prevents the object from changing in this method, but does not mean that the object itself cannot change its state by other conditions.

 

Why can't I see the global terminal variables in the tester in visual mode (emulated, of course)?

Do global terminal variables work in the tester at all?

Документация по MQL5: Основы языка / Переменные / Глобальные переменные
Документация по MQL5: Основы языка / Переменные / Глобальные переменные
  • www.mql5.com
Глобальные переменные создаются путем размещения их объявлений вне описания какой-либо функции. Глобальные переменные определяются на том же уровне, что и функции, т. е. не локальны ни в каком блоке. Область видимости глобальных переменных - вся программа, глобальные переменные доступны из всех функций, определенных в программе...
 
Andrey Dik:

Why can't I see the global terminal variables in the tester in visual mode (emulated, of course)?

Do global terminal variables work in the tester at all?

It has always been possible (F3). They work.

 
Alexey Navoykov:

In the first case, you are changing a static variable, not a class member, so the constant has nothing to do with it at all.

Should this script return sum = 0 ?

or should this script even return a compilation error?

void OnStart()
{
   int sum = 0;
   for(int i = 0; i < 3 ; i++)
   {
      const int j = f(i);
      sum += j * i;
   }
   printf("sum = %i", sum);
}
//+------------------------------------------------------------------+
int f(int v)
{
   return(v);
}
//+------------------------------------------------------------------+
 
Igor Makanu:

should the script return sum = 0 ?

Or should this script even return a compile-time error?

At least run a debugger before you write ridiculous statements.
On the second loop i == 1 and j == 1, and on the third and so on both are one more.

Reason: