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

 
Yes, at the beginning, my most common mistake so far is not putting a semicolon where it should be. I just forget to do it. Then I sit and think, what the program doesn't like in this line? Now I have a problem with external function call. The example here is 'Order Management - It's Easy'. First we have Expert Advisor, then function (which I am actually interested in), and then Expert Advisor with this function plugged in. I have tried to do it with my own example, but it did not work. Then I tried the examples, described in the article, and failed again. I have saved the function and expert in one folder. When compiling the Expert Advisor, the error 'OneOrderControl.mq4' - cannot open the program file D:\Program Files\MetaTrader 4 Ukrsotsbank\experts\Test.mq4 (3, 1). I don't understand what is the problem so far.
 
Climber:
I tried to use my own example, but failed. Then I used the examples in the article and failed again. I saved the function and the Expert Advisor in the same folder.
The include file (OneOrderControl.mq4) should be in the directory experts\include
 
After all))))
Thanks. Now figuring out how to find out the maximum price at the last 40 bars.
 
Climber:
Now figuring out how to find out the maximum price on the last 40 bars.

See Task 26 in Tutorial - Variables - Arrays.
 
Uh, can't it be done in a wiki? Then it would be easy to edit and add to the pdf/doc/xml/ .... You can kick it out at any time.
 
SK. писал (а):
Climber:
Now figuring out how to find out the maximum price on the last 40 bars.

See Task 26 in Tutorial - Variables - Arrays.
Right, that's it. That's it. Thank you. (chuckles) I've been sloppy.
 
Do I understand correctly the execution of the if statement condition?
if (My - UD*Point >= Ask && _OrdersTotal != 1)          
     {                                          
      Opn_B=true;
If the variable Mu minus the variable UD multiplied by the point price is greater than or equal to Ask and at the same time the variable _OrdersTotal is not equal to 1, then the variable Opn_B is assigned the value true. That is, only if these two conditions are met the variable Opn_B is assigned the value true. And if a comma is put instead of &&, then true is assigned when at least one of the conditions is met.
 
Climber:
Am I reading the if statement condition correctly?
if (My - UD*Point >= Ask && _OrdersTotal != 1)          
     {                                          
      Opn_B=true;
If the variable Mu minus variable UD multiplied by the point price is more or equal to Ask and at the same time the variable _OrdersTotal is not equal to 1, then the variable Opn_B is assigned the value true. That is, only if these two conditions are met the variable Opn_B is assigned the value true. And if a comma is put instead of &&, then true is assigned when at least one of the conditions is met.


This is correct in general.

But the expression specified in the if() statement header is a boolean one. It does not imply the possibility of "comma". In order to implement the second option you describe, it is necessary to put || (logical OR) instead of && (logical AND). In this case, the whole expression in the header (in parentheses) will be true if at least one of the expressions separated by || is true.

The use of parentheses is allowed. Parentheses have higher priority in calculations (like normal arithmetic calculations).

 
Renat:
The other day we launched the beta version of Sergei Kovalev's(SK.) online book on MQL4 programming.
https://book.mql4.com/ru

For now only Russian version works, but we will try to translate it to English and Chinese
If you have any comments about the book, please let us know.

I have two different computers and different browsers, but the pictures on https://book.mql4.com/ru/metaeditor/compose do not work.
 
Martes:

On two different computers and with different browsers, the images on https://book.mql4.com/ru/metaeditor/compose are not showing.
Strange how it can be. I don't understand the problem.
Reason: