My approach. The core is the engine. - page 47

 
Реter Konow:

Rather, I am critical of my work. That's why I am improving all the time.

Anatoly is good. No doubt about it. The library is good.

But, even the window I showed you today can be done with great difficulty. Not to mention much more.

Just for the sake of interest, you may compose and show here the code you need to write to repeat my window and we will compare it with my version.

Question to the question: Can you describe why that window is needed and how it helps in semi-automatic trading?

 
Реter Konow:

Why did you write the gui library?

Working with graphical objects in MT4 is also the most time-consuming. Not only you have to create an object, but also set a bunch of properties. To simplify the work with graphical objects I had several functions that allow to quickly create some graphical objects. When MT5 appeared, all graphic objects in it have even more properties and the number of parameters in functions increased so much, that they looked silly. Therefore a question arose - how to simplify the work with graphical objects under the new conditions. As OOP appeared, its applications were considered. As a result, first a class for fast work with one graphical object was created. Then the idea of creating several compound elements emerged. I liked the idea and wrote the first article - how to create my own controls. Everything went so smoothly and in 2-3 weeks, practicing for fun, I had created several controls similar to standard ones and created a library, its description is provided in the second article. The third article was about forms, but it was more of a formality for the library and I decided to complete it. But it was too bad about forms, I didn't figure out how to make them better. Also, there were no mouse movement events back then, so scroll bars are weird and form is dragged in an unusual way. As for the forms - instead of prompting, they were anathematized. And there's not a lot of work for the library to be very handy. I even have thoughts to improve it, rework scroll-bars, drag-and-drop form, and make the form itself in another way, which would not copy a blank class, and create an object and connect controls to it.

 
Vitaly Muzichenko:

Question per question: Can you describe why that window is needed and how it helps in semi-automatic trading?

Semi-automatic trading, is the same incomprehensible and financially damaging "crap" as fully automatic or manual trading.

Just another type of trading that may interest traders.

 
Artyom Trishkin:

Consider it as you see fit. You may reread the discussions of Anatoly's articles - there are your attempts to compete. But Anatoly did everything long ago, modestly, qualitatively, professionally, "without noise and dust", and you are still praising yourself.

The question is - how to use it? Do you have to read 50 articles? And yet it's called "quick and easy", how paradoxical.

 
Dmitry Fedoseev:

The question is - how to use it? Do you have to read 50 articles?

I somehow figured it out quickly - without the articles. Read them of course - came out, read them from my mobile. To understand what is described there. But creating and working with objects there is simpler than in Peter's. Create the required number of objects with descriptions of properties in OnInit() and use their messages in OnChartEvent(). The usual event model.

Later I adapted his library for myself - made it crossplatform, added saving values of all created objects, to prevent resetting to their original state during reinitialization, added sounds for many interactions with objects (set by default and individually, and disabled - so that it didn't constantly ringing and tinkling), tried and abandoned it - I have my own ideas. Anatoly's library doesn't allow to create objects on the fly, by means of new from the program, doesn't allow to make more than one window active... In general - it has a lot to develop. But this is a question for him. Or to yourself - to make what you need for your needs and with all the required objects and possibilities of their use.

 
Artyom Trishkin:

I somehow figured it out quickly - without the articles. Read them of course - came out, read them from my mobile. To understand what is described there. But creating and working with objects there is simpler than in Peter's. Create the required number of objects with descriptions of properties in OnInit() and use their messages in OnChartEvent(). It's the usual event model.

I then digitized his library for myself - made it crossplatform, added saving values of all created objects, so that they are not reset to their original state when reinitialized, added sounds for many interactions with objects (set by default and individually, and disabled - so that it didn't constantly ring and binge), played around and gave up - I have my own ideas. Anatoly's library doesn't allow to create objects on the fly, by means of new from the program, doesn't allow to make more than one window active... In general - it has a lot to develop. But this is a question for him. Or to yourself - to make what you need for your needs and with all the required objects and possibilities of their use.

I think it's possible to create objects via new. And the creation of forms is the same dumb as mine, and in the standard library is the same - you have to copy the form template. It's interesting that I was criticized so much, almost anathematized for my forms, but they haven't moved on from that point.

 

that's the pace... that's the speed!

While I moved to 60km, 15 pages were thrown into the topic. Total of 1 page for 4(!) km ;-)

Peter has no time to move the core and kernel engine.

 
Dmitry Fedoseev:

Objects can probably be created with new, it can't be impossible, or is it really impossible? And the creation of forms - as dumb as mine, and in the standard library is also the same - you have to copy the blank form. It's interesting that I was criticized so much, I was almost anathematized for my forms, but they haven't moved on from that point.

Yes, I have to repeat the same code a hundred times for a hundred windows, but with different parameters. I got rid of that. For each control I created a universal method of its creation - I just needed to enter the required parameters for each element. Therefore, it was very easy for me to create - I needed a window - CreateWindow(initial, individual, parameters), etc. And then, if the element is created, it's possible to add trinkets to it, or leave it as standard by default.

I.e., approximately (structurally) like that:

CreateWindow(0);

CreateButton(1,0,координаты);

CreateButton(2,0,координаты);

...

CreateNuclearBomb(1,0,координаты);

...

Well and it's already enough to have one window with two buttons and one atomic bomb :)

But I reworked Anatoly's library. It's more complicated, as it seems to me.

As for creation on new - if my memory doesn't change - I haven't looked into the code for a long time - he has one object on a global level, and it already serves for creating and controlling all the elements.

Of course, you can try to make a list with several libraries, created by new, and then in the timer and events to view these lists and what happens in them. But once I tried it, each such object reacts to actions of neighboring objects - when you move one window, the rest also flail about. So I gave up trying to figure it out - there was no time.

 
Artyom Trishkin:

Yes, you have to repeat the same code a hundred times for a hundred windows, but with your own parameters. I got rid of that - for each control I made a universal method of its creation - just type in the right parameters for each element. Therefore, it was very easy for me to create - I needed a window - CreateWindow(initial, individual, parameters), etc. And then, if the element is created, it's possible to add trinkets to it, or leave it as standard by default.

I.e., approximately (structurally) like that:

CreateWindow(0);

CreateButton(1,0,координаты);

CreateButton(2,0,координаты);

...

CreateNuclearBomb(1,0,координаты);

...

Well and it's already enough to have one window with two buttons and one atomic bomb :)

But I reworked Anatoly's library. It's more complicated, as it seems to me.

As for creation on new - if my memory doesn't change - I haven't looked into the code for a long time - he has one object on a global level, and it already serves for creating and controlling all the elements.

Of course, you can try to make a list with several libraries, created by new, and then in the timer and events to view these lists and what happens in them. But once I tried it, each such object reacts to actions of neighboring objects - when you move one window, the rest also flail about. I don't have time to figure it out.

What is parameter 0 for CreateWindow(0) and CreateButton()? With CreateWindow(0), it's a window identifier, while with CreateButton(), it means buttons will be on form 0. Or not at all? Only one form is possible and all controls will be on it?

 
Dmitry Fedoseev:

What is parameter 0 of CreateWindow(0) and CreateButton()? With CreateWindow(0) this is the window identifier and with CreateButton() it means the buttons will be on form 0. Or not at all? Only one form is possible and all controls will be on it?

Each element can be attached to another. You got it right, the "0" is the identifier of the element. It was a schematic representation of GUI design principle. Buttons have it, so they will be attached to this window. If I didn't add a binding to the window, it would be attached to the chart. I think that's how it's done there - I can't remember exactly.