Beta version of the online book on MQL4 programming - by Sergey Kovalev (SK.) - page 11

 

to SK

1. The tutorial was posted as a beta version, i.e. with an offer of criticism.
2. Well, I stressed the sentence and found the line "all arrays are static by definition".))) i.e. this is not my problem.
3. If we arbitrarily follow this one criticized line of textbook supposedly all arrays by definition are static, we can get an address error "incorrred start position 0 for ArrayMinimum function" in the tracer
(this one single line does not detract from the merits of the textbook, kudos to you SK)
4) So. A static array is, first of all, in the sense of memory allocation,
or not, there may be a new initialization of each element.
What do we see in MQL4? At each call each element is neatly initialized with default zero, explicitly from the definition.
I.e. data in subprograms are not stored without static pre-definition.
It means that MQL4 subprograms are executed with dynamic allocation of variable memory.
All variables and all arrays without explicit size in MQL4 subprograms are dynamic by default. Otherwise, they should be fixed with static description.
5. For example, dynamic memory allocation is an opportunity to declare double a[][]...[]; with empty dimensions,
but it is necessary to mention that programmer should be responsible for addressing.
(In the above example, the standard function is addressed by an old reference and does not fall within the array boundaries).

 
Korey:

to SK


OK.
 
The question is as follows.

The book is written in Russian. The developers say that the translation into English is in process, and then in Chinese will appear. I am sure that only explanations are translated; nobody is going to touch the source code.

Many programmers by nature give understandable names to variables from their language, for example here on the site I met massiv (masiv), Koef and even MuH_IIIuPuHa_KaHaJIa. So, while leafing through a textbook, I came across the following code:




What does a Chinatown resident have to say looking at the Tip variable ? We know what it is, but what do others know?

( Found here: https://book.mql4.com/ru/trading/orderclose )
 
Parabellum:
The question is as follows.

The book is written in Russian. The developers say that the translation into English is in process, and then in Chinese will appear. I am sure that only explanations are translated; nobody is going to touch the source code.

Many programmers by nature give understandable names to variables from their language, for example here on the site I met massiv (masiv), Koef and even MuH_IIIuPuHa_KaHaJIa. So, while leafing through a textbook, I came across the following code:




What does a Chinatown resident have to say looking at the Tip variable ? We know what it is, but what do others know?

( Found here: https://book.mql4.com/ru/trading/orderclose )

Thanks for the remark!
The names of variables in the examples, of course, will not touch - in Chinese, for example, the source code does not use hieroglyphs, they have to deal with the Latin alphabet in any case. In order to understand the meaning of this variable, the "inhabitant of Chinatown" will simply look at the comment. Also, the inhabitants of English-speaking countries will not perceive the word Tip as "type" either. Because "type" in English would be type. And Tip is "tip" or even "hint". But it doesn't prevent them from understanding the codes of Russian-speaking developers. ))
 

But I think a native speaker still needs to look at the names of the variables. So as not to step on a rake. What if the variable Tip - its sound is the same as the Russian three-letter word, which has in the middle the letter U (.u.) . And if it is not? It would not look good in a book.

It may be simpler and more correct.

int _OrdetType=OrderType();

if ( _OrdetType > 1 ) ....

 

The assumption is that the reader will still think a little...

 

Here https://book.mql4.com/ru/build/lots there are missing division marks

there's

Lots_New=MathFloor(Free*Percent100One_Lot/Step)*Step;// Calculate

We need

Lots_New=MathFloor(Free*Percent/100/One_Lot/Step)*Step;// Calculate


It's a bit awkward, I think I can see the code. I want to take a slice, but not all of it. I.e. I copy what I see into the buffer and paste it into the text of my program. But it is not inserted correctly. The whole code goes to one line. The end of line code in the book and in the MQL editor most likely do not coincide

 

here's another small edit.

https://book.mql4.com/ru/build/trading

There is

switch() control is passed to the case 10 label (block 2-3).


Need

.... (block 2).

 
Prival:

Here https://book.mql4.com/ru/build/lots there are missing division marks

there's

Lots_New=MathFloor(Free*Percent100One_Lot/Step)*Step;// Calculate

We need

Lots_New=MathFloor(Free*Percent/100/One_Lot/Step)*Step;// Calculate


It's a bit awkward, I think I can see the code. I want to take a slice, but not all of it. I.e. I copy what I see into the buffer and paste it into the text of my program. But it is not inserted correctly. The whole code goes to one line. The end of line code in the book and in the MQL editor most likely do not coincide


Yes, it's the same formatting problems. We'll fix it tomorrow.

Thank you for finding the error.

There are authenticated files for all finished codes. The code in the files is believed to be correct. By the way, it can also be used as a reference to look for typos and inaccuracies.

 
Prival:

here's another small edit.

https://book.mql4.com/ru/build/trading

There is

switch() control is passed to the case 10 label (block 2-3).


Need

.... (block 2).



There is no need to correct here. All blocks have a start and an end point. In this case 2 is the start, 3 the end.

Thanks anyway:)

Reason: