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

 
Programmers who trade hands and are able to axe additional libraries and know how to use it are few and far between.

Programmers who can write their own library are also few and far between.

There are many users who want a GUI. But for them, everything should be simple. As simple as two times two.
For this purpose, it is necessary to make a separate project that allows you to work as vs

Peter do what you think is necessary. You can only judge the demand once you've got the statistics dialed in. I mean, we tried to make an account statistics collection indicator with you. I just didn't want to bother because I still haven't finished the calculation part.
Although I'm sure your GUI is easier to program than mine, which is already done.
I'm just constantly modifying and it's easier for me to manage my code myself, I don't want to ask anyone else to do it.


But there are few real users who will appreciate your work. I tell you from my own experience.
I've made a free library for experts. An informational ready library. Which displays only information and allows you to manage any Expert Advisor.
There are hundreds of downloads. I have been thanked a couple of times. China, Brazil, Thailand and Russia are downloading it. That's it.

Your library will be useful for sellers who want a nice interface. But one will have to compare speed and brakes with glitches. I have encountered it.

Everything else is unimportant.
Do your own thing. No need to prove anything.
 
Vladislav Andruschenko:
There are very few programmers who are handy and can handle and use additional libraries.

Programmers who can write their own library are also few and far between.

There are many users who want a GUI. But for them, everything should be simple. As simple as two times two.
For this purpose, it is necessary to make a separate project that allows you to work as vs

Peter do what you think is necessary. You can only judge the demand once you have set the statistics. I mean, we tried to make an account statistics collection indicator with you. I just didn't want to bother because I still haven't finished the calculation part.
Although I'm sure your GUI is easier to program than mine, which is already done.
I'm just constantly modifying and it's easier for me to manage my code myself, I don't want to ask anyone else to do it.


But there are few real users who will appreciate your work. I tell you from my own experience.
I've made a free library for experts. An informational ready library. Which displays only information and allows you to manage any Expert Advisor.
There are hundreds of downloads. I have been thanked a couple of times. China, Brazil, Thailand and Russia are downloading it. That's it.

Your library will be useful for sellers who want a nice interface. But one will have to compare speed and brakes with glitches. I have encountered it.

Everything else is unimportant.
Do your own thing. No need to prove anything.


Thank you. Your opinion, as a developer and salesman with vast experience, is very important to me.

 
Реter Konow:


Thank you. Your opinion, as a developer and seller with vast experience, is very important to me.

Thank you.
The main goal is that the library does not affect the main algorithm of the Expert Advisor.
I was faced with this at the beginning when I was making my library.
 
Vladislav Andruschenko:
Thank you.
The main goal is that the library does not affect the main EA algorithm.
I was faced with this at the beginning when I was making my library.

All of my connections are purely external. It doesn't affect it in any way.

You drew the GUI in the markup language. It is carried by indicator "engine".

We connected 2 files to the EA and filled in the connection file.

We have started the engine with GUI and the Expert Advisor.

And everything works.

 
Vladislav Andruschenko:
...

There are also very few programmers who can write their own library.

...

I disagree. Everyone who programs in MQL, even non-professionals, if they have been doing it for a long time, has rather many of their original functions. It's easy to batch them together and convert them into a file in the form of a library. I think that most are able to do it.

 
khorosh:

I disagree. Everyone who programs in MQL, even non-professionals if they have been doing it for a long time, has accumulated a lot of their own original functions. It's easy to put them together and file them as a library. I think most people can do it.

I'm not talking about a set of functions. I mean a library with GUI. Trust me. It's complicated to organise. And Peter has done a great job.
 

I will repeat the task once again:

  1. The MT program should change the state of the elements of the windows form (pressed/repressed).
  2. The MT program must change the colour of the buttons on the windows form.
  3. The MT program must accept text fromthe input fields of the windows form.
  4. The MT program must set the text in the input fields of the windows form.
  5. The MT program must open/close the windows of the windows application.

It's pretty straightforward. You need to draw two simple forms in C#. There should be a button, an input field and a checkbox. Add a DLL. Connect with MT5.

I will make my analogue in MT. Same forms and elements, and doing the same functions. Next, let's compare solutions in terms of quality and development potential.

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here is my solution:


//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Control code in the Expert Advisor:

void OnTimer()
  { 
   static int q,q2,q3,q4,q5;    q++; q2++; q3++; q4++; q5++;
   //-----------------------------------------------------------------
   //Реализуем изменение цвета кнопки внутри формы.
   //-----------------------------------------------------------------
   if(q == 1)E_Window_1_Button_1(M_COLOR,C'245,245,245');
   if(q == 2)E_Window_1_Button_1(M_COLOR,C'245,0,0');
   if(q == 3)q = 0;
   //-----------------------------------------------------------------
   //Реализуем программное нажатие/отжатие/блокировку кнопки.
   //-----------------------------------------------------------------
   if(q2 == 1)E_Window_1_Button_2(STATE,ON);  
   if(q2 == 2)E_Window_1_Button_2(STATE,LOCKED_ON);
   if(q2 == 3)E_Window_1_Button_2(STATE,OFF);
   if(q2 == 4)E_Window_1_Button_2(STATE,LOCKED_OFF);
   if(q2 == 5)q2 = 0;
   //-----------------------------------------------------------------
   //Реализуем программное нажатие/отжатие/блокировку чекбоксов.
   //-----------------------------------------------------------------
   if(q3 == 1){E_Window_1_Checkbox_1(STATE,ON);         E_Window_1_Checkbox_2(STATE,LOCKED_ON);  E_Window_1_Checkbox_3(STATE,OFF);} 
   if(q3 == 2){E_Window_1_Checkbox_1(STATE,LOCKED_ON);  E_Window_1_Checkbox_2(STATE,OFF);        E_Window_1_Checkbox_3(STATE,ON);}
   if(q3 == 3){E_Window_1_Checkbox_1(STATE,OFF);        E_Window_1_Checkbox_2(STATE,ON);         E_Window_1_Checkbox_3(STATE,LOCKED_ON);}
   if(q3 == 4)q3 = 0;
   //-----------------------------------------------------------------
   //Реализуем изменение текста в поле ввода:
   //-----------------------------------------------------------------
   E_Window_1_Edit_box_1("Current text: " + MathRand());
   //-----------------------------------------------------------------
   //Реализуем изменение цвета текста в поле ввода.
   //-----------------------------------------------------------------
   if(q4 == 1)E_Window_1_Edit_box_1(T_COLOR,C'145,245,245');
   if(q4 == 2)E_Window_1_Edit_box_1(T_COLOR,C'245,10,0');
   if(q4 == 3)E_Window_1_Edit_box_1(T_COLOR,C'245,20,50');
   if(q4 == 4)E_Window_1_Edit_box_1(T_COLOR,C'245,130,0');
   if(q4 == 5)E_Window_1_Edit_box_1(T_COLOR,C'25,40,20');
   if(q4 == 6)E_Window_1_Edit_box_1(T_COLOR,C'245,170,0');
   if(q4 == 7)E_Window_1_Edit_box_1(T_COLOR,C'245,110,110');
   if(q4 == 8)E_Window_1_Edit_box_1(T_COLOR,C'245,255,0');
   if(q4 == 9)q4 = 0;
   //-----------------------------------------------------------------
   //Реализуем поочередное закрытие/открытие окон:
   //-----------------------------------------------------------------
   if(q5 == 1)W_Window_2(close);
   if(q5 == 5)W_Window_2();
   if(q5 == 10)q5 = 0;
   //-----------------------------------------------------------------
  }
//+------------------------------------------------------------------+

Files connected below:

1. Test EA file (install in EAs folder, open, save, compile, put on chart).

2. The External Connection file (install it in the inclusion folder).

3. Connection Properties file (install in the inclusive folder).

4. Forum sample 2 file with window code (view only).

5. Engine (install in the indicators folder. Put it on the chart with the test EA).

 
I hope my opponents will provide their solution to the problem of connecting a Windows form via a DLL.
 
Реter Konow:
I hope my opponents will provide their solution to the problem of connecting Windows form via DLL.

I have a feeling that you are the only one participating in this "special Olympiad" :-)

 

Please, in the appendix. When you start the Expert Advisor, a window will open, in the window there are two buttons, two text boxes and a checkbox. The colour of the buttons and the text in the first text box changes once per second. If text is entered in the second text field, the Expert Advisor will open an alert with an event message and this text. Pressing the buttons also opens the alert and the first button opens form-2, the second button closes form-2. You can also close form-2 with a cross. The main form (form 1) will not be closed by a cross, it will disappear when the EA is disconnected. The checkbox also opens an alert and there are two types of events from it: 1 and 2 - uncheck and checkbox.

Most of my time was spent on remembering C# (if I knew something there:), I haven't done anything in it for more than three years and also on developing a class for passing events, but it's universal, it can be used in any project. So now when creating a gui it counts for minutes ;).

If you're wondering how time consuming it is internally, you need to call a class method to pass an event to the EA - one line. To be able to control controls from an EA you need to write two methods, one in the form class and one in the event transfer class, one line of code in each of them.

I haven't made checkbox controls in their EA - I'm bored with them, they have already set colour and text - both text parameter and ints. Colour is transmitted as RGB, but probably could be done by one variable, I did not deeply delve into it.

And there is an assumption that someone who knows C# and FindowsForms better can do it twice as easy - without two methods to set the properties, but with only one, and maybe do something better.

Well, the gates to the infinite world of C# and FindowsForms are open.


Files: