![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
It works :)
It crashes :)Pulling the plug removes also all objects, as well as throwing the computer out of the window.
Pulling the plug removes also all objects
No. Please read the function above - it 1) found prefixes, used by CControlsDialog for its graphic parts in the past (extract it from crashed parts) 2) remove only objects with these 'invalid' prefixes
as well as throwing the computer out of the window.
:)
that why i use
Doerk:
native MQL4
No. Please read the function above - it 1) found prefixes, used by CControlsDialog for its graphic parts in the past (extract it from crashed parts) 2) remove only objects with these 'invalid' prefixes
:)
The question is the same: How do you create the instances, and how and where do you delete or destroy them. I studied the deepest kernels of these classes. They do not crash and they´re clean in view of memory management - if you use them right. A simple way to "crash" an instance is, when you do not use the message queue and i. E. you have a button to delete the whole "window" which´s functionality is executed inside the instance. What you describe sounds exactly like that, and that´s a safe way to confuse MQL and to crash at least the debugger. But believe me, nothing of these things happen when you´re code is clean in view of OOP.
Post your code.
The question is the same: How do you create the instances, and how and where do you delete or destroy them
Panel constractor called only once - at OnInit, destructor - only once, at OnDeinit, it crashes at OnDeinit. It was OK a few months ago, but started after one of these months updates. But this isn't a problem for me - my codes updated, every next OnInit clean unnecessary panel parts
Post your code.
It contains 3098 lines. I hope you can investigate Young Ho Seo code
Panel constractor called only once - at OnInit, destructor - only once, at OnDeinit, it crashes at OnDeinit. It was OK a few months ago, but started after one of these months updates. But this isn't a problem for me - my codes updated, every next OnInit clean unnecessary panel parts
It contains 3098 lines. I hope you can investigate Young Ho Seo code
What do you mean by "constructor" ? The constructor is executed BEFORE OnInit(), and the destructor AFTER OnDeinit(). If you mean the .Create() function, you cannot put the .Create() function inside the OnInit() just like that, you need to check if the OnInit() was already executed, because the OnInit() is called after each change of the timeframe and after each change of the settings. Use a static variable or function to check if the OnInit() was executed. And you also do not need to use the .Destroy() in OnDeinit(), because, assuming that your panel object is a static object, this will be deleted by MQL when the EA is removed, and this will result in deletion of ALL objects which belong to the CArrayObj object which is part of every CWndContainer and every class deriving from it.
Maybe this is already your key:
that why i use
And that´s really a pity. You seem to have good ideas in view of correlation, programming and so on, but MQL4 gives you very tight barriers.
I can only recommend to everybody who is at least able to understand OOP, to reset his brain to basics and to re-learn programming on an OOP basis. OOP, here MQL5, definitely brings you on the next level of programming where you have possibilities that you never can achieve with native programming, at a efficiency which is also so many times higher than with native programming. One who claims it isn´t like that, simply never understood OOP entirely and the power behind it, especially inheritance and virtual overloading, which are THE ultimate keys at all. Just using the standard library is not real OOP programming, but it can be a good start to get into it. MQL5 is simply amazing and it´s 100% compatible with MT4 too.
If you mean the .Create() function, you cannot put the .Create() function inside the OnInit() just like that, you need to check if the OnInit() was already executed
1. Thanks, will check it, if this problem occurs somewhere again
2. Please look into any MetaQuotes codes in the standard MT4 or MT5 distributive - SimplePanel.mq4 or SimplePanel.mq5 or ChartPanel.mq5. Seems like you know how to use the 'standard library' much better then SL authors - all .Create() functions in MqtaQuote's codes placed into OnInit without any 'run only once' conditions
And you also do not need to use the .Destroy() in OnDeinit()
And all .Destroy() placed into OnDeinit in the MetaQuotes codes. Maybe this is because every new OnInit (.Create) always follows after OnDeinit (.Destroy) so there is no crime in creating a new set after deleting the old one?
1. Thanks, will check it, if this problem occurs somewhere again
2. Please look into any MetaQuotes codes in the standard MT4 or MT5 distributive - SimplePanel.mq4 or SimplePanel.mq5 or ChartPanel.mq5. Seems like you know how to use the 'standard library' much better then SL authors - all .Create() functions in MqtaQuote's codes placed into OnInit without any 'run only once' conditions
And all .Destroy() placed into OnDeinit in the MetaQuotes codes. Maybe this is because every new OnInit (.Create) always follows after OnDeinit (.Destroy) so there is no crime in creating a new set after deleting the old one?