Disappearing Graphical Objects

 

Hello there

I chose to start my journey into the depths of object-oriented programming with mql5, so naturally I am facing many obstacles in my attempts to understand its inner-workings. I am trying to create a graphical interface for a panel that would have an ability to add graphical objects inside its body (e.g. buttons). I've created a new class for it, with original name "MyPanel" which is a descendent of "CChartObjectSubChart". I declared an object      CChartObjectSubChart ObjPanel;   then I used      ObjPanel.Create(params)      function in the constructor       MyPanel();   and in the trial EA I simply declared new instance of "MyPanel" class within OnInit function.

What it did, when I added the trial EA to a chart, was to display my "ObjPanel" in the specified subwindow and then it disappeared for good after a sec. The QUESTION: how do I get the object to stay on the chart and not disappear. As far as I understand, it's creation within the constructor is not correct. Does the terminal refreshes its memory after new pack of quotes is received and that causes the subchart to disappear? I also want my Panel to change some of its properties when new quotes are received (duhh) and to do that I guess I'll have to use virtual Save() and Load() functions somehow. Could you explain when the creation of the object should occur?  I'd like to work on the new properties of the "MyPanel" class adding new methods and then see what I have done. Also, I wonder if SubChart is a good choice for the panel window (I chose it cause I thought I'd get easier access to quotes by attaching it to a chart... could be plain dumb) or other graphical objects (like button or RectLabel) will serve this purpose better?

I'd be grateful if anyone can help me.

Reason: