Errors, bugs, questions - page 702

 
Yedelkin:
Will the global variables in the terminal work?

Hmmm... I must be missing something... We're talking about an indicator.

int G=10;

int OnInit()
  {
   G++;
   Print(G);

   return(0);
  }
I've been playing around with the timeframes - it always comes out 11. What I need is 11, 12, 13...

Dumping it into a file is fine, but it doesn't look good to me. If there's nothing else, I'll have to dump it to a file...

 
x100intraday:
Look again at the link in my post. It doesn't talk about global program variables, it talks about global terminal variables (for some reason programmers like to overload not only functions, but terms as well).
 
Yedelkin:
Look again at the link in my post. It doesn't talk about global program variables, but about global terminal variables (for some reason programmers like to overload not only functions, but terms as well).
Yes, yes, thank you, I'm already educating myself...
 
Yedelkin:
It does not say about global variables of the program, but about global variables of the terminal (for some reason programmers like to overload not only the functions, but also the terms).
The client terminal's global variables appeared in T (to be more exact, in D; T became T when the custom indicators appeared). At that time in MQL II there was no concept of "function" in principle. That is, in the abstraction of "MQL-program" the client terminal's global variables looked very harmonious. When they switched to 4, it was too late to change the term.
Переход на новые рельсы: пользовательские индикаторы в MQL5
Переход на новые рельсы: пользовательские индикаторы в MQL5
  • 2009.11.23
  • Андрей
  • www.mql5.com
Я не буду перечислять все новые возможности и особенности нового терминала и языка. Их действительно много, и некоторые новинки вполне достойны освещения в отдельной статье. Вы не увидите здесь кода, написанного по принципам объектно-ориентированного программирования — это слишком серьезная тема для того, чтобы просто быть упомянутой в контексте как дополнительная вкусность для кодописателей. В этой статье остановимся подробней на индикаторах, их строении, отображении, видах, а также особенностях их написания по сравнению с MQL4.
 
stringo:
Global variables of the client terminal appeared in the triple (to be more exact, in the double; triple became when the custom indicators appeared). At that time there was no concept of "function" in MQL II. That is, in the abstraction of "MQL-program" the client terminal's global variables looked very harmonious. By the time they got to MQL4, it was too late to change the term.
I'm not complaining. It's just that when you're learning a language for the first time, overloading the phrase "global variables" throws you into a bit of a stupor. My example and that of x100intraday show it. So I decided to explain to my colleague that there is such a problem/peculiarity. ...But if the question of terminology is touched, I would call the second category of variables "global program variables", based on the history of the topic.
x100intraday:
How to save the last value of a variable when switching between timeframes? Well, a deinitialization-initialization process takes place, everything is dumped... while I want it to be saved.
Come to think of it, there is also a third way - to use custom events. I.e. a custom event expert-receiver is placed at one symbol, and custom event transmitter programs are placed at required symbols. The expert-receiver handles incoming user events as it is trained. This includes the ability to remember the value of a variable being sent. The basic approach is in Lizar's article (can't remember the name).
 
Yedelkin:
It's not like I'm complaining.
"a little history" (c) Mike
 

Will there be any comments on my post above? By the way the account is not only in the wrong group or rather it really seems to have opened on the wrong server.

 
olyakish:

Will there be any comments on my post above? By the way the account is not only in the wrong group or rather it really seems to have opened on the wrong server.


The issue has been added to the servicedesk
 

5. MQL5: Исправлено поведение функции ArrayIsDynamic. При инициализации динамического массива списком инициализации функция ArrayIsDynamic определяла массив как статический.

How will the ArrayIsDynamic function define an array when a dynamic array is initialised with an initialisation list?
 
Yedelkin:
How will the ArrayIsDynamic function define an array when a dynamic array is initialized with an initialization list?

Static.

An array that looks dynamic and has an initialization list is considered static with an automatically defined size.