MasterWindows Library - Library for MetaTrader 4 | MT4 EA Download - MetaTrader 4 Resources







This " MQL5 for Dummies: How to Design and Build Object Classes " article explains how to create a user-friendly interface for your program. The implementation of the interactive window is based on the use of the MasterWindows class library.

Figure 1. MasterWindows library usage example
The MasterWindows library consists of three base classes:
//+------------------------------------------------------------------+ //|Basic CELL class CCell | //+------------------------------------------------------------------+ class C Cell { private : protected : Boolean value on_event; // event handling flag ENUM_OBJECT type; // cell type people : WinCell property; // Cell property string Name; // Cell name //+------------------------------------------------------------------------+ // Class constructor blank CCell(); virtual // Method: Draw an object blank draw( string myname, integer m_xdelta, integer m_ydelta, integer m_b size); Virtual // OnChartEvent event handling method blank event occurs ( constant integer ID, constant- length &l parameter, constant double &d parameter, constant string &sparam); };
//+------------------------------------------------------------------+ //|Basic ROW class CRow | //+------------------------------------------------------------------+ class CR line { protected : Boolean value on_event; // event handling flag people : String Name; // Row Name WinCell Property; // Row Properties //+--------------------------------------------------------------------------------+ // Class Constructor Blank Crow(); virtual // method: draw a blank line draw( string my name, integer m_xdelta, integer m_ydelta, integer m_b size); Virtual // OnChartEvent event handling method blank event occurs ( constant integer ID, constant- length &l parameter, constant double &d parameter, constant string &sparam); };
//+------------------------------------------------------------------+ //|Basic window class CWin | //+------------------------------------------------------------------+ Class West Vancouver { Private : Blank Set XY ( integer m_angle); // Method to calculate coordinates Protected : Boolean value on_event; // event handling flag people : string name; // Window name integer w_angle; // Anchor point integer w_xdelta; // Vertical indentation integer w_ydelta; // Horizontal indentation integer w_xpos; // Anchor point's X coordinate integer w_ypos; // Anchor point's Y coordinate integer w_b size; // Window's width integer w_h_size; // Window's height integer w_h_angle; // HIDE mode anchor angle WinCell property; // Window properties // --- CRowType1 STR1; // Declaration class row CRowType2 STR2; // Declaration class row CRowType3 STR3; // Declaration class row CRowType4 STR4; // Declaration class row CRowType5 STR5; // Declaration class row CRowType6 STR6; // Declaration class row //+--------------------------------------------------------------------------------+ // Class constructor blank CWin(); //The data acquisition method is blank. Set Win( string my name, integer m_xdelta, integer m_ydelta, integer m_b size, integer m_angle); Virtual // Method: Draw a window blank draw( integer &MMint[][ 3 ], string &MMstr[][ 3 ], integer count); Virtual // OnEventTick event handling method blank OnEventTick(); Virtual // OnChartEvent event handling method blank event occurs ( constant integer ID, constant- length &l parameter, constant double &d parameter, constant string &sparam); };
and 10 descendants.
The attachment contains templates and code examples using the MasterWindows library. The code was generated using the visual window constructor of MQL5's MasterWindows . The test program is a mockup, i.e. it does not have any functionality (except the close window functionality).
You can use any number and combination of rows in the window. This image shows a basic version of row and window titles:

Figure 2. Basic options and possibilities of the library
For example, for the article " Testing the Performance of Moving Average Calculation in MQL5 " we created the following interface using the suggested library.

Figure 3. Example using the MasterWindows library

Figure 4. Example of using the library in the trading panel

Figure 5. Example of using the library in the game panel

Figure 6. Example of using the library in the trading panel

Figure 7. Example of using the library in a multi-currency trading panel
suggestion:
Attachment download
📎 classunit.mqh (15.5 KB)
📎 classrow.mqh (22.28 KB)
📎 classwin.mqh (8.23 KB)
📎 test1.mq4 (7.93 KB)
Source: MQL5 #15883
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •