Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1593
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Almost a second (highlighted in yellow).
Hello, Vladimir.
If I understand correctly, you have highlighted in yellow not the execution time but the time for compiling this code. Compilation is performed once, after that you run the already compiled file on the chart or in the tester. That's why you may not worry much about this indicator. It does not reflect how slow or fast the Expert Advisor will work on a chart.
you didn't allocate runtime, you allocated time to compile this code.
Hello, Vladimir.
If I understand correctly, you have highlighted in yellow not the execution time but the compilation time of this code. Compilation is performed once, after that you run the already compiled file on the chart or in the tester. That's why you may not worry much about this indicator. It does not reflect how slow or fast the Expert Advisor will work on a chart.
Hello, Yuri, will the compilation time of this code be much different from the execution time? To be honest, I am not good at this issue. It is good that if it is so , as you wrote. ) I decided to check the compilation time of my code again right now and suddenly got a completely different result:
Now I don't understand at all why there is such a significant difference in compilation time compared to yesterday's data. ))
Regards, Vladimir.
Hello, Yuri, will the compilation time of this code be much different from the execution time? Frankly speaking, I am not good at this issue. It is good that if it is so , as you wrote. )
I decided to check the compilation time of my codeagain right nowand unexpectedly got a completely different result:
Compilation, roughly speaking, is the process of converting the code you have written in MQL5 into commands encoded with zeros and ones, which can be executed by the processor. It is performed by MetaEditor when you press the "Compile" button. Therefore, the duration of this process depends mainly on the number of lines in the written programme and the .mqh library files attached to it. But also the current load of your computer by other background processes at the moment of compilation affects the duration. For example, if you are listening to music in parallel (on the same computer), then playing it requires a part of computational resources, which can be taken away from the compilation process. But besides music, there are usually dozens of other processes launched by the operating system running in the background . At different times these processes create different load on the processor, so the duration of compilation can be different at different times.
When launching a programme, for example, an EA in the terminal, there is no recompilation. Therefore, the compilation time is not added to the execution time at each launch. This is the difference between compiled languages and interpreted languages.
As to whether there is a dependence between compilation time and runtime, imagine this example:
In terms of the number of operations that need to be encoded during compilation, they are very few: a few arithmetic operations, conditional operations and jump operations. That's why compilation of such a code will take very little time. And when you start executing such a code, the while loop will be infinite because the value of x only decreases and will never become more than 100. That's why the execution time can be as long as you like.
It is clear that this is an intentionally exaggerated example. However, in real programmes, it often happens that a rather compact source code requires a considerable amount of time to execute.
Almost a second (highlighted in yellow).
I have a question for real programmers - please suggest some simpler and faster version.
Regards, Vladimir.
Hi Vladimir. Note 1:
It would be better to write it like this
Remark 2:
Maybe it's easier to count the number of daily bars rather than taking into account weekend times?
Like this:
Compilation, roughly speaking, is the process of converting the code you have written in MQL5 into commands encoded with zeros and ones, which can be executed by the processor............
It is clear that this is an intentionally exaggerated example. However, in real programmes it often happens that a rather compact source code requires considerable time for execution.
Yuri, thank you for your detailed explanation. I will know now. Live and learn!!! ))
Regards, Vladimir.
Eliminate all cycles, prepare data in such a way that it can be used on the next tick without cycles. Or almost. That's it.
It would be great, Alexey, but I have not managed to do without cycles yet. ) Thanks for the hint!
Regards, Vladimir.
Hi Vladimir. Comment 1:
it would be better to write it like this
Remark 2:
Maybe it's easier to count the number of daily bars rather than counting weekend times?
Roughly like this:
Hi Alexei, thanks for the tips. I will definitely test your option. )
Regards, Vladimir.
Good evening and good mood, everyone!
I've long been used to the word handle, but how to briefly describe its true meaning? Search engines all kinds of digging and found in my opinion the best explanation. Although I may be mistaken!
Taken from Wikipedia and specially condensed to a concept acceptable to me:
Handle (descriptor - not the best name either!) is a pointer to the source of further information retrieval.
Dear programmers!!! How would you briefly characterise the word handle?
Regards, Vladimir.