Errors, bugs, questions - page 2297
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
Thank you, but I didn't see any answers to my questions there.
I don't understand why destructor is not called whenA *a= new A;
https://www.mql5.com/ru/docs/basis/variables/object_live
All the objects created by the expression pointer_object=newClass_name must be destroyed by the delete(pointer_object) operator afterwards. If, for some reason, this variable was not destroyedby the delete operator, the message about it will appear in the "Experts" journal. It is possible to declare several variables and assign them all to the same object pointer.
I ask MQL to check OnTimer() function.
For some reason it does not work in strategy tester for MT4 (no errors, just nothing inside this function is executed), while online it is OK.
For MT5 the function works both in the tester and online.
Thank you!
In OnInit only two numbers are compared, and it takes more time for an Incorrect pass than a full pass! How come?
Let's run this Expert Advisor on full optimization
We get the result of working with 8 Agents
Here's our Expert Advisor now
At last, like this one
Two outputs
On the second point, there's clearly some sort of error. It is more beneficial in terms of time to perform an empty run, rather than popping out of OnInit. Please correct it because the advantages of Incorrect-Init and ExpertRemove will be almost completely lost.
The favourites tab with EAs/indicators/scripts and accounts is only remembered after exiting the terminal. Because of this, an abnormal exit (power out) resets this tab. Is it possible to save it when changing it?
Sometimes there is a clear understanding that it would be very handy if folders could be added to the favourites.
Then try it like this:
Result:
1:POINTER_AUTOMATIC
1:POINTER_DYNAMIC
2:POINTER_DYNAMIC
2:POINTER_AUTOMATIC
Thank you! Quite a solution.
But it's probably better that the compiler doesn't swear:
Is this a bug or what?
When you create an instance of a class via new , it doesn't call the destructor.
Is this the only solution to create a special class for calling the destructor? Or can we do without it?
Create with new and delete with delete
The question is to put delete in a destructor, but when creating an instance of a class via new (A *a=newA ;) the destructor is not called.
Is it possible, and if yes, how, to derive in any ZigZag indicator the corresponding values of price extremums High and Low,
ensuring their stable binding and close proximity to the formed tops and bottoms?
See example fromOBJ_TEXT
https://www.mql5.com/ru/docs/basis/variables/object_live
Thank you.
That's exactly what it says here.
So it's not a bug, it's a feature which results in a vicious circle.
If I want to automate the process of deleting a dynamic object, the destructor is called only at delete, so it is useless to put delete into the destructor itself.
But automation can be implemented through another instance of another class, as @A100 suggestedhere.
Thanks for the tip. I'm already exhausted from reading and trying and trying and reading. I'd like to see a working example of the ZigZag...
Like on my avatar with a zigzag, but with a RIGHT binding of upper extrema, because the binding of lower extrema is OK!
The way of binding with k=(WindowPriceMax()-WindowPriceMin())/30 does not work when the window size changes much, I wish something else...
In theOBJ_TEXT example both top and bottom bind. Follow the link, run the example ...
So it's not a bug, but a feature, resulting in a vicious circle.
You have already been told earlier that the way to solve the control of allocated unmanageable resources is to use smart pointers. The full analogy with C++.
Perhaps the problem is that the solution wasn't presented on a silver platter, sorry.
Everyone can type "shared_ptr" into site search and follow the first result, it's not hard, I strongly recommend to try it.