Pretty useful. Thanks.
Thanks for the article! How can I change the background and border colour of the panel itself? I haven't found it in the standard classes.
Maxim Dmitrievsky:
Thanks for the article! How can I change the background and border colour of the panel itself? I haven't found it in the standard classes.
If you use the simple way, you can't. I didn't look for a complicated way.
Thanks for the article! How can I change the background and border colour of the panel itself? I haven't found it in the standard classes.
Maxim Dmitrievsky:
Thanks for the article! How can I change the background and border colour of the panel itself? I haven't found it in the standard classes.
Override defines in Defines.mqh.
Thanks for the article! How can I change the background and border colour of the panel itself? I haven't found it in the standard classes.
Andrey Khatimlianskii:
Redefine defines in Defines.mqh.
Redefine defines in Defines.mqh.
- In the next update the standard library will be restored and the Defines.mqh file will be restored accordingly.
- It is not good to edit the standard library.
Karputov Vladimir:
I did not suggest to edit it. You should redefine it after including this file, but before creating the panel.
- In the nearest update the standard library will be restored - accordingly the Defines.mqh file will be restored.
- It is not good to edit the standard library.
Andrey Khatimlianskii:
I didn't suggest to edit it. You need to override it after enabling this file, but before creating the panel.
Could you please tell me how to do it on a simple example, I am not very good at oop. I changed the colours of defines in the library itself - the colour of the panel does not change.
I didn't suggest to edit it. You need to override it after enabling this file, but before creating the panel.
Maxim Dmitrievsky:
Please tell me how to do it on a simple example, I don't know much about oop. I changed the colours of the defines in the library itself - the colour of the panel does not change
Please tell me how to do it on a simple example, I don't know much about oop. I changed the colours of the defines in the library itself - the colour of the panel does not change
After changing the file, recompile the EA, it should work. And don't forget to make a back-up to restore your variant after the update.
Overriding is done using #undef and #define. But you need to put them in the right place ;)
Andrey Khatimlianskii:
The only detail that distinguishes ... from ... .
Overriding is done with #undef and #define. But you have to put them in the right place ;)
Andrey Khatimlianskii:
After changing the file, recompile the EA, it should work. And don't forget to make a back-up to restore your variant after the update.
Overriding is done using #undef and #define. But you need to put them in the right place ;)
Well, that's how I did it, nothing works. The panel is still white as before
The compiler writes Macro redifinition, i.e. it is a type of overriding....
//+------------------------------------------------------------------+ //|MyPanel.mqh | //|Copyright © 2013, DeltaTrader | //| http://www.deltatrader.com.br | //+------------------------------------------------------------------+ #property copyright "DeltaTrader © 2013" #property link "www.deltatrader.com.br" #property version "1.000" #property description "Test Panel" #property indicator_plots 0 //+------------------------------------------------------------------+ //| Includes| //+------------------------------------------------------------------+ #include <Controls\Dialog.mqh> #include <Controls\Label.mqh> #include <Controls\Panel.mqh> #include <Controls\Edit.mqh> #include <Controls\Defines.mqh> #define CONTROLS_DIALOG_COLOR_BORDER_LIGHT C'0x00,0x00,0xFF' #define CONTROLS_DIALOG_COLOR_BORDER_DARK C'0x00,0x00,0xFF' #define CONTROLS_DIALOG_COLOR_BG C'0x00,0x00,0xFF' #define CONTROLS_DIALOG_COLOR_CAPTION_TEXT C'0x00,0x00,0xFF' #define CONTROLS_DIALOG_COLOR_CLIENT_BG C'0x00,0x00,0xFF' #define CONTROLS_DIALOG_COLOR_CLIENT_BORDER C'0x00,0x00,0xFF' //+------------------------------------------------------------------+ //| Global parameters| //+------------------------------------------------------------------+ int panelXX = 200; int panelYY = 200; int panelWidth = 600; int panelHeight = 400; CAppDialog m_panel; //--- Bid objects CPanel m_bidcolor; CLabel m_bidlabel; //--- Ask objects CPanel m_askcolor; CLabel m_asklabel; CEdit m_edit; //+------------------------------------------------------------------+ //| On Init| //+------------------------------------------------------------------+ int OnInit() { //--- Panel create m_panel.Create(0,"blablabla",0,panelXX,panelYY,panelWidth,panelHeight); //--- Bid label and colours m_bidcolor.Create(0,"Bid Background Color",0,1,1,panelWidth-30,30); m_bidcolor.ColorBackground(clrYellow); m_panel.Add(m_bidcolor); m_bidlabel.Create(0,"Bid Text",0,5,5,0,0); m_bidlabel.Text("Bid "+DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits)); m_bidlabel.Color(clrBlue); m_panel.Add(m_bidlabel); //--- Ask labels and colours m_askcolor.Create(0,"Ask Background Color",0,1,1,panelWidth-30,30); m_askcolor.ColorBackground(clrAqua); m_panel.Add(m_askcolor); m_asklabel.Create(0,"Ask Text",0,5,30,0,0); m_asklabel.Text("Ask "+DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits)); m_asklabel.Color(clrRed); m_panel.Add(m_asklabel); m_edit.Create(0,"Bid Background Color",0,1,1,panelWidth-30,30); m_panel.Add(m_edit); //--- Run panel m_panel.Run(); return(0); } //+------------------------------------------------------------------+ //| On DeInit| //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- Destroy panel m_panel.Destroy(reason); //--- Delete all objects ObjectsDeleteAll(0,0); } //+------------------------------------------------------------------+ //| On Calculate| //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { //--- A very simples bid label m_bidlabel.Text("Bid "+DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits)); //--- A very simples ask label m_asklabel.Text("Ask "+DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits)); //--- return(rates_total); } //+------------------------------------------------------------------+ //| On Chart Event| //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- Move the panel with the mouse m_panel.ChartEvent(id,lparam,dparam,sparam); //--- } //+------------------------------------------------------------------+

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
New article Adding a control panel to an indicator or an Expert Advisor in no time has been published:
Have you ever felt the need to add a graphical panel to your indicator or Expert Advisor for greater speed and convenience? In this article, you will find out how to implement the dialog panel with the input parameters into your MQL4/MQL5 program step by step.
Your MQL4/MQL5 indicator or Expert Advisor may be the most efficient in the world but there is always a room for improvements. In most cases, you need to enter the program's settings to change its inputs. However, this step can be avoided.
Develop your own control panel based on Standard Library classes. This will allow you to change the settings without restarting a program. Besides, this will make your program more attractive allowing it to stand out from the competitors. You can browse through multiple graphical panels in the Market.
In this article, I will show you how to add a simple panel to your MQL4/MQL5 program. You will also find out how to teach a program to read the inputs and react to changes of their values.
2.2. Panel
The finalized PanelDialog2.mqh panel looks as follows:
Fig. 4. Panel number two
What are the benefits of combining the MACD Sample.mq5 EA with the PanelDialog2.mqh panel? This allows us to quickly change the EA parameters (Lots, Trailing Stop Level (in pips), and others), as well as trade event notification settings (Mail, Push, and Alert) on the current timeframe the EA is to be launched at.
Changed EA parameters (Lots, Trailing Stop Level (in pips), and others) are applied after clicking the Apply changes button. Changes of the trade event notification settings (Mail, Push, and Alert) are applied automatically. There is no need to press the Apply changes button.
Author: Karputov Vladimir