Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1522
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
Structure is an element of OOP.
So that's where my doubts came from. As a rule, I write in a simple procedural language, and a very good person suggested to me that I should learn to use a custom structure. It turned out that custom structure works without any OOP. )) Now I'm sitting here thinking whether it's necessary to use custom structure in procedural code at all, when I've been able to calmly handle global variables before. ))
Regards, Vladimir.
I can't imagine how you can implement the appearance of a new object with several different properties without structures / OOP.
Disappearance of one of the old objects (for example, a monster was killed).
Especially if the number of objects is dynamically changing and is not known in advance.
There are a lot of examples of measuring speed / comparing execution of different code fragments here.
The same saber posts several examples every day.
1. Create a high-resolution timer
2. Print its value before the operation is executed.
3. After operation execution.
The difference is the time of operation execution.
Do it for a regular variable and for a structure and compare.
Oh, my! I never even thought about it. It's about"I can't imagine how you can implement the appearance of a new object with several different properties without structures / OOP".
Thank you very much for telling me in detail how to make speed measurements!!!
Regards, Vladimir.
like this, to put it together,
or to create monster structures in the game
further
example from the help... I changed the names.Thanks for the tip. Now I begin to realise the value in using custom structure.
Regards, Vladimir.
Do you need to use the handle? There is a function that deletes an indicator with the specified name from the specified chart window .
IndicatorDelete(int,const string) - Price Charts - Standard Library - MQL5 Reference Manual - Reference Manual for MetaTrader 5 Algorithmic/Automatic Trading Language for MetaTrader 5
Regards, Vladimir.
Do you need to use the handle? There is a function that removes an indicator with the specified name from the specified chart window .
IndicatorDelete(int,const string) - Price Charts - Standard Library - MQL5 Reference - Reference Manual for MetaTrader 5 Algorithmic/Automated Trading Language for MetaTrader 5
Regards, Vladimir.
It is easier to take a function than a SB...
For detailing how to do the speed measurements, thank you so much!!!!
Regards, Vladimir.
Volodya, now I found out that my knowledge and tips on speed measurements are somewhat outdated.
I used to use the functions of a high-resolution timer ( milliseconds) EventSetMillisecondTimer(), which should be set in OnInit() and then use the GetTickCount() function in a script / Expert Advisor / indicator.
Now I saw in the https://www.mql5.com/ru/forum/170952/page255 thread that the GetMicrosecondCount() function has appeared (and maybe it was there before). It is a bit easier to work with it and the resolution is 3 orders of magnitude higher.
Example of use in the link above to the branch and in the documentation.
Volodya, now I found out that my knowledge and tips on speed measurements are somewhat outdated.
I used to use the functions of a high-resolution timer ( milliseconds) EventSetMillisecondTimer(), which should be set in OnInit() and then use the GetTickCount() function in a script / Expert Advisor / indicator.
Now I saw in the https://www.mql5.com/ru/forum/170952/page255 thread that the GetMicrosecondCount() function has appeared (and maybe it was there before). It is a bit easier to work with it and the resolution is 3 orders of magnitude higher.
Example of use in the link above to the branch and in the documentation.
Thank you very much! I'll try to measure the speed this weekend. )) Especially since there is an example in the documentation.
Regards, Vladimir.
Thank you so much! I'll try to measure the speed this weekend. )) Especially since there is an example in the documentation.
Regards, Vladimir.
Only the speed should be measured for a million iterations of the cycle. Otherwise, the error will be very high.
Only the speed should be measured per million iterations of the cycle. Otherwise, the error will be very high.
Hi Alexey, thanks for the clarification. ))
Regards, Vladimir.