I have never studied programming, but I want to write an EA

 
Sergey Lobzankin:

Good day boys and girls,
here are some variables globally
I want to get the opening prices in the log.



But i get some strange nonsense.
What's wrong?


You set the date very strangely. Read about the date:

datetime NY=D'2015.01.01 00:00';     // время наступления 2015 года 
datetime d1=D'1980.07.19 12:30:27';  // год месяц день часы минуты секунды 
datetime d2=D'19.07.1980 12:30:27';  // равнозначно D'1980.07.19 12:30:27'; 
datetime d3=D'19.07.1980 12';        // равнозначно D'1980.07.19 12:00:00' 
datetime d4=D'01.01.2004';           // равнозначно D'01.01.2004 00:00:00' 
datetime compilation_date=__DATE__;             // дата компиляции 
datetime compilation_date_time=__DATETIME__;    // дата и время компиляции  
datetime compilation_time=__DATETIME__-__DATE__;// время компиляции 
//--- примеры объявлений, на которые будут получены предупреждения компилятора 
datetime warning1=D'12:30:27';       // равнозначно D'[дата компиляции] 12:30:27' 
datetime warning2=D'';               // равнозначно __DATETIME__

About translating a date into a structure - TimeToStruct.


What is your purpose? What exactly are you checking for in OnTick?


Just in case: if you set datetime variable to zero, it will actually become D'1970.01.01 00:00:00'.

 
Sergey Lobzankin:

hello boys and girls,
here are some variables globally
I want to get the opening prices in the log.



but I'm getting some strange nonsense.
What's wrong?


I think we should start at the beginning. For example, with the help.

It is also a good idea to open any EA and break it down to each operator.

Welcome to the world of programmers!

 
Sergey Lobzankin:

good afternoon boys and girls,
here are some variables globally
I want to get the opening prices in the log.



but I'm getting some strange nonsense.
What's wrong?


And good riddance to you. Judging by the treatment at your tender age, it's too late to rush through the code looking for something wrong. Everything in your code is wrong and wrong.
 
Roman Shiredchenko:
And good riddance to you. Judging by the treatment at your tender age, it's too late to rush through the code looking for something wrong. Everything in your code is wrong and wrong.

It's never too late to start. If a person will have a will, he will understand. All of us once looked at simple if, else, like barnacles at a new gate ;)

 
Sergey Lobzankin:

Good afternoon boys and girls,
here are some variables globally
I want to get the opening prices in the log.



but I'm getting some strange nonsense.
What's wrong?


sounds something like this.

I've never studied surgery, but I want to do surgery, so here's an axe, a drill and a file. What's wrong?

 
Sergey Lobzankin:

Good day boys and girls,
here are some variables globally
I want to get the opening prices in the log.



but I'm getting some strange nonsense.
What's wrong?


If you really want to learn how to program in MQL, it's a good idea to start by reading articles that teach you how to program from the basics. This site is full of such articles. However, if you are completely ignorant, it is hard to find what you need. To learn the language syntax without studying the program structure is useless.

https://book.mql4.com/ru

https://www.mql5.com/ru/articles/100

 
Sergey Lobzankin:

good afternoon boys and girls,
here are some variables globally i want to get opening prices into the log.

But I get incomprehensible nonsense. What's wrong?

Typed your example into the script - the EA would repeatedly output to the log

datetime dt=D'00:00';

void start()
{
  if (dt==D'00:00') Alert(PRICE_OPEN);
}

I have discarded functions OnInit and OnDeinit - you have them empty. I have removed the variables which are not used. I used Alert instead of Print to immediately print the variable to the screen. Outputs the value of the PRICE_OPEN constant which is equal to 1. Put the cursor there and press F1.

Keep on studying programming - it's difficult for an EA without it. One of my acquaintances has studied video tutorials and has written a smart Expert Advisor

 

Thank you for your responsiveness)
I do, a little bit every day,
video tutorials, articles, forums.
all your comments are very helpful to me)

 
Sergey Vradiy:

If you really want to learn how to program in MQL, it's a good idea to start by reading articles that teach you how to program from the basics. This site is full of such articles. However, if you are completely ignorant, it is hard to find what you need. To learn the language syntax without studying the program structure is useless.

https://book.mql4.com/ru

https://www.mql5.com/ru/articles/100

thanks for the tutorial.
I started reading it and it looks like a normal person wrote it)))
I downloaded a self-study book, 3000 pages, and it's all like a dry reference.

 
Sergey Lobzankin:

Thanks for the textbook.
I started reading it, it seems that a normal person wrote it)))
I downloaded a self-study book, 3000 pages, and it's like a dry reference.

Just reading the reference without setting the objectives (even if very simple) does not do anything. It's like learning karate by looking at pictures while lying on the sofa :)