Features of the mql5 language, subtleties and tricks - page 268
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
This is so that everyone can understand how it will be (click the copk after Calculated appears):
Why?! It's obvious that EventChartCustom is done after the calculations are released. You have Sleep as the final "calculations". So it should have been after it that the EventChartCustom should be done .
Actually, this is exactly what you have done through OOP. Initially, the demonstration was an approach for finalisation, built on your knees.
Forum on trading, automated trading systems and testing trading strategies
Peculiarities of mql5 language, subtleties and techniques of work
Vladimir Simakov, 2024.09.24 11:06 AM
It should be like this:
Such would add for reliability.
What the fuck?! It's obvious that EventChartCustom is done after the calculations are released. In your case, Sleep is the final "calculation". Therefore, it should be after it that EventChartCustom should be done .
Actually, this is exactly what you have done through OOP. Initially, the demonstration was an approach for finalisation, built on your knees.
Because the result will be like this:
TComputer is a fancy, third-party library, which the whole world will use))))) No, not even so, it will be a part of the local standard library)))))
Naturally, your code, which has been working smoothly for a long time, will be translated to it, and even without tests, and why, everything is so trivial and exactly such a call is shown in the help))))
I'm talking about the fact that unfinished solutions, thrown in once, lead to exactly such consequences. Believe me, I've been through it. Asynchronous programming is exactly about such tricks.
This kind of thing would be added for credibility.
Well done! That's right. Now we don't need a constructor)
But immediately a problem came up. EventChartCustom ended with false. What do we do next, how will we protect ourselves from our evil-evil?))))))
EventChartCustom ended with false. What do we do next, how do we protect ourselves from our evil-evil?))))))
Exactly what the code says.
Speaking of birds, there is a solution if you think about the future right away, but you have to do it at the terminal level.
As an example, so, the first thing that came to mind.
We need to add two fields to all event calls (OnX).
ulong id; // monotonically increases at each event.
ulong lastFinishedId; // id of the last OnX, which was completed at the moment when this event started forming.
Exactly what the code says.
So, if the button is pressed again, we get an unexpected call?
So if a button was pressed repeatedly, we get an unexpected call?
Yes. When ChartEventCustom returns false, it is an abnormal situation. Adding Solution1 can help with it.
Because that's what the result will be:
Stubbornly duplicating EventChartCustom calls. It's just a matter of enthusiasm to complete the foolproofing.
As a small step.
You persistently duplicate calls of EventChartCustom. It's just a matter of enthusiasm to complete the foolproofing.
As a small step.
Except there are two ways to do it. Either you know about these problems and handle them, or you take a beating in the release.