Discussion of article "Create Your Own Graphical Panels in MQL5"

 

New article Create Your Own Graphical Panels in MQL5 is published:

The MQL5 program usability is determined by both its rich functionality and an elaborate graphical user interface. Visual perception is sometimes more important than fast and stable operation. Here is a step-by-step guide to creating display panels on the basis of the Standard Library classes on your own.



Author: MetaQuotes

 

At the moment the library is customised for one panel on the chart.

If you try to add 2 panels, the events are caught incorrectly - the elements have the same Id, and the parent Id is not checked.

To test it, I took the demo Controls.mq5 and duplicated the panel - all events are duplicated to both panels, although they should not be.

 
In the item "Filling the display panel" can we use something like
ObjCAppDialog.Create(chart,name,subwin,x1,y1,x2,y2))
instead of
CAppDialog::Create(chart,name,subwin,x1,y1,x2,y2))
?
 
Rorschach:
In the item "Filling the display panel" can instead of using something like ?

Good day, maybe you can tell me what to do.

Your example ekspert Controls.

When switching to a different period the expert is unloaded, tried removing ExtDialog.Destroy(reason); in OnDeinit().

Can you tell me what I need to do to make the dialogue window continue to work when switching to other periods?

Документация по MQL5: Программы MQL5 / Выполнение программ
Документация по MQL5: Программы MQL5 / Выполнение программ
  • www.mql5.com
Программы MQL5 / Выполнение программ - Документация по MQL5
 
vdv2001:

Good day, maybe you can tell me what to do.

Your example is an Expert Advisor Controls.

When switching to another period the Expert Advisor is unloaded, I tried to remove ExtDialog.Destroy(reason); in OnDeinit().

Can you tell me what I need to do to make the dialogue window continue to work when switching to other periods?

Thank you very much for your remark. The error is fixed. Update in the next build.
 

IMHO, I think that it is easier to create libraries by hand, to know where and how to use or to fix if something is wrong.

Example of writing a panel without using standard classes: VirtualTradePad PositionsStyle

 

One can wonder why using MQL5 Wizard to build a class produce a code that doesn't compile :


As stated in the article, you have to add this line of code manually, this is a little weird for a Wizard intended for non-coder

#include <Controls\Dialog.mqh>

Also :

This article will demonstrate how easy it is to create your own display panels in a separate chart subwindow using the Standard Library classes.

I think this is a joke, not ?

MQL5 Wizard: Creating Expert Advisors without Programming
  • 2011.01.11
  • MetaQuotes Software Corp.
  • www.mql5.com
Do you want to try out a trading strategy while wasting no time for programming? In MQL5 Wizard you can simply select the type of trading signals, add modules of trailing positions and money management - and your work is done! Create your own implementations of modules or order them via the Jobs service - and combine your new modules with existing ones.
 

" this is a little weird for a Wizard intended for non-coder."

I do not think that this wizard is for non-coders.

It might get you (the novice programmer) a foot in the necessary first steps to create something.

The MQL5 framework offers a lot of potential and some of it might be discovered with wizard creations

but I think to get something more complex like this example you will allways need the basics of programming.

But I agree it should be necessary to include the obvious stuff if you derive form a base class...

 
ugo58:

" this is a little weird for a Wizard intended for non-coder."

I do not think that this wizard is for non-coders.

It might get you (the novice programmer) a foot in the necessary first steps to create something.

The MQL5 framework offers a lot of potential and some of it might be discovered with wizard creations

but I think to get something more complex like this example you will allways need the basics of programming.

But I agree it should be necessary to include the obvious stuff if you derive form a base class...

You are probably right, but I thought MQL5 Wizard was designed first for non-coder. Anyway the issue is like a bug here, as you have to add code manually to compile the code created by Wizard.

MQL5 Wizard: Creating Expert Advisors without Programming
  • 2011.01.11
  • MetaQuotes Software Corp.
  • www.mql5.com
Do you want to try out a trading strategy while wasting no time for programming? In MQL5 Wizard you can simply select the type of trading signals, add modules of trailing positions and money management - and your work is done! Create your own implementations of modules or order them via the Jobs service - and combine your new modules with existing ones.
 

I noticed that in the library of user GUIs (panels) is copied not quite successful in my opinion event model:

void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
    ...
}

Firstly, not all events have a set of variables corresponding to int, long, double and string. Somewhere there may be more variables describing the event, somewhere less, somewhere they do not coincide with the proposed basic types. In fact, we see constant conversions like int -> bool, string -> int, double -> int, etc. And if from the point of view of procedural programming there is practically nothing you can do (because you will not create 1 000 000 overloaded functions for each hypothetical case), then within the framework of OOP everything can be done much easier and more elegant.

But the main problem of OnEvent is that this event handler is intended to handle events received from the chart, while the event can be anything, such as opening a new position or changing quotes. In general, OnEvent(...) somehow does not look like a universal event handler, IMHO. Perhaps the developers have somehow managed to handle their own events on the basis of the existing CWnd, but for me using the standard library of panels is still problematic.

Как использовать торговые классы Стандартной библиотеки при написании советника
Как использовать торговые классы Стандартной библиотеки при написании советника
  • 2010.11.10
  • Samuel
  • www.mql5.com
В статье рассказывается о том, как использовать основной функционал торговых классов Стандартной библиотеки при написании советников, в которых применяется открытие, закрытие и модификация позиции, проверка свободной маржи перед размещением торговых ордеров, размещение и удаление отложенных ордеров. Показано, как использовать торговые классы для получения свойств ордеров и сделок.
 

Thanks, I've studied it, it's useful! A few moments: are there any plans to create some kind of constructor, so that panels could be assembled in the form constructor like in VS? because it's not quite convenient to count everything by hand, maybe it's a sign of professionalism, but it takes a long time)).

with macros they have obviously overdone it...