Crowdsourced GUI. Open beta testing.

 

I offer the community a GUI builder for MQL programsfor free use.

  • The GUI builder is a closed .ex5 file, in order to centralise its development and avoid confusion when distributing versions.
  • The GUI engine is attached by an open file .mqh, but! -I do not recommend changing the code on your own, without consulting me, as it can lead to errors and loss of functionality.
  • Please inform me about bugs and defects.

I will be grateful for your constructive participation.

P.S. The project is crowdsourced, which means we will implement it together.

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

CONSTRUCTION:

  • KIB.ex5 - GUI builder.
  • File GUI_DRIVE.mqh - GUI engine in user application. It is connected by the file.
  • Indicator KIB-source.mqh - marking code transmitter from user project files to the constructor.

INSTRUCTIONS FOR INSTALLATION:

Step 1 - unpacking:

  • Place the KIB.ex5 advisor in the Expert folder. (Do not place in subfolders).
  • Place GUI_DRIVE.mqh file in the include folder. (Do not place in subfolders).
  • Place KIB-source.mqh indicator in the Indicators folder. (Do not place in subfolders).

Step 2 - Install files:

  • Install the KIB.ex5 Expert Advisor on a free chart.
  • Open KIB-source.mqh indicator in MetaEditor and compile it to get .ex5 file.
  • Install the resulting file KIB-source.ex5 on the same chart with the Expert Advisor KIB.ex5.

Step 3 - preparation for work:

  • Create a "MyProjects" folder for your new GUI project inside the include folder.
  • Create file Window_1.mqh for writing the markup. Open the file.
  • Prescribe the connection of this file at the bottom of KIB-source.mqh inside "source" array initialization (#include <MyProjects\Window_1.mqh>).

Step 4 - getting started:

  • Write the simplest code:

//----------------------------------------------------------------------------------
NEW_WINDOW,  W_NAME, " Hello World! ",  W_ICON, "::Images\\16x16\\Folder.bmp",  W_TYPE, SETTINGS, ALWAYS_ON_TOP,
//----------------------------------------------------------------------------------
GROUP, "Кнопка",

__,BUTTON, "Hello World!",

END_GROUP,
//--------------------------
i, AT, _X2X, "MF", 10, _Y2Y, "MF", 10,
//----------------------------------------------------------------------------------
END_WINDOW,

  • Compile the file KIB-source.mqh. A window with a button should appear on the graph.

Step 5 - Design the user GUI:

  • In the additional branch, tutorials and code examples will be provided to help create the desired GUI.

Step 6 - Save the custom GUI:

  • Call the context menu of the constructor by double-clicking on the graphic.
  • Select the last item "Save project and print API file".
  • The Files folder contains two files: "CORES.mqh" and "Internal_API.mqh".
  • Manually move these files into the folder MyProjects from the folder "Files".
  • The project is saved.

Step 7 - Connect the user GUI to the Expert Advisor:

//+------------------------------------------------------------------+
//|                                                   GUI Expert.mq5 |
//|                                                      Peter Konow |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Peter Konow"
//--------------------------------------------------------------------
#include<GUI_DRIVE.mqh>
#include<MyProject_1\CORES.mqh>
#include<MyProject_1\Internal_API.mqh> 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   //--- create timer
   EventSetMillisecondTimer(25);
   //-------------------------
   D_OnInit();
   //-------------------------
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
   //-------------------------
   D_OnDeinit();
   //-------------------------
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
   //ВАШ КОД-----------------
   //ВАШ КОД-----------------
   //ВАШ КОД-----------------
   //ВАШ КОД-----------------
   //ВАШ КОД-----------------
   //УСТАНОВИТЬ ВЫЗОВ В САМОМ НИЗУ, ПОД ПОЛЬЗ.КОДОМ.------------------
   //---------------------------
   RMSG(1);
   //---------------------------
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   //УСТАНОВИТЬ ВЫЗОВ НА САМОМ ВЕРХУ, НАД ПОЛЬЗ.КОДОМ.---------------
   //----------------------------------------------------------------
   D_OnChartEvent(id,lparam,dparam,sparam);
   //----------------------------------------------------------------
  }
//+------------------------------------------------------------------+


Step 8 - receiving events from the controls:

  • Events come to a function inside the "Internal_API.mqh" file.

//========================================================================================================= 
void On_Gui_Event(int Element, string value, double Magic = 0)
{
 string action = value, selected_option = value; //DON'T CHANGE THIS LINE
//------------------------------------
 switch(Element)
   {
//=====================================================================================================================
//WINDOW:   Checkboxes | element: CHECKBOX  | name: Checkbox 1  |  Location: Window's Main Frame
//=====================================================================================================================
case CHECKBOX3___Checkbox_1:
               //------------------------------------------------------------------------------------------------------
               //What to do when checkbox checked or unchecked?
               //------------------------------------------------------------------------------------------------------
               switch((int)action)
               {
                case checked:     break;
  
                case unchecked:     break;
               }
               //------------------------------------------------------------------------------------------------------
               //Your comment:
               //------------------------------------------------------------------------------------------------------
               break;
  
...

  • Prescribe in its cases the required reactions of the user functionality.


HH. There is a compiled version of the builder with integrated resources on the blog :https://www.mql5.com/ru/blogs/post/733356

This version has only open source code, because the resources are located in different folders (sounds and subfolders with pictures) and there's no sense in transferring everything here with huge amount of explanations.

Документация по MQL5: Операции с массивами / ArrayInitialize
Документация по MQL5: Операции с массивами / ArrayInitialize
  • www.mql5.com
Функция ArrayResize() позволяет задать для массива размер с некоторым запасом для его будущего увеличения без физического перераспределения памяти. Это сделано для улучшения быстродействия, так как операции по распределению памяти...
Files:
KIB-source.mq5  132 kb
GUI_DRIVE.mqh  2013 kb
KIB.zip  1470 kb
 

Closed Code -> Marketplace.

Open code -> Forum.

 
Vladimir Karputov:

Closed Code -> Marketplace.

Open code -> Forum.

Okay. I'll post the open source code of the constructor. But, I need a couple of days to brush it up. Will you agree to wait?

 
Реter Konow:

Good. I'll publish the open source code of the constructor. But, I'll need a couple of days to comb through it. Will you agree to wait?

Your theme isn't going anywhere.

 
"Shaw? Again?!)
 
Dmitriy Skub:
"What? Again?!)
Haven't combed it yet, hang on.
 
Реter Konow:


By the way, try creating a Project:


 
Vladimir Karputov:

By the way, try creating a Project:


Okay. Just to clarify. The constructor or engine code itself is over 20,000 lines of code. In this thread, I wanted to teach people how to create a GUI in a markup language, not how to understand the code of the constructor itself. Therefore, I want to lay out the constructor code in one file, for user convenience.

 
Реter Konow:

All right. Just to clarify. The constructor or engine code itself is over 20,000 lines of code. In this thread, I wanted to teach people how to create a GUI in a markup language, not how to understand the code of the constructor itself. That's why I want to post the constructor code in one file, for users' convenience.

Nope. That way, every Market Seller will start its own branch like "Test my best EA".

 
Vladimir Karputov:

Nope. That's how every Market vendor will start their own "Test my best EA" thread.

(chuckles) Okay. Whatever. I'll post it as is.

 
Реter Konow:

P.S. The project is crowdsourced, which means we implement it together.

is there or will there be crowdsourcing in the project?

I think you are looking for testers, not those who will join together and "finish the code" to production (even if the code is free)

Reason: