Questions from Beginners MQL4 MT4 MetaTrader 4 - page 53

 
Vitaly Muzichenko:

It goes something like this:

Great, the profits add up. Thank you!
 

Good afternoon, Can anyone suggest a solution to this issue. There is a code with entry on M15, but the signal from H1 is taken into account. While there is a signal on H1, on M15 the indicator gives several signals. The question is how to limit it to one (i.e. the first signal).

k=0;
for (i=OrdersTotal()-1;i>=0;i--)
{
RefreshRates();
if(OrderSelect (i, SELECT_BY_POS, MODE_TRADES) == true) a = 0;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) k++;
}


if( stM1 >= 80 && stM0 < 80 && stH0 < 30 && k==0 && opp != Time[0]) // sale

 

I wrote a small info panel:

extern string     Display                    = "Настройки отображения"; //Display
extern color      PanelBackgroundColor       = Black;
extern color      PanelTextColor             = White;

double MaxDD;

int OnInit()
  {
//--- indicator buffers mapping
  
   ObjectCreate("Background", OBJ_RECTANGLE_LABEL, 0, 0, 0);
   ObjectSet("Background", OBJPROP_CORNER, 0);
   ObjectSet("Background", OBJPROP_XDISTANCE, 5);
   ObjectSet("Background", OBJPROP_YDISTANCE, 35);
   ObjectSet("Background", OBJPROP_XSIZE, 215);
   ObjectSet("Background", OBJPROP_YSIZE, 220);  
   ObjectSet("Background", OBJPROP_BGCOLOR, PanelBackgroundColor);
  
   ObjectCreate("Account information", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Account information", OBJPROP_CORNER, 0);
   ObjectSet("Account information", OBJPROP_XDISTANCE, 15);
   ObjectSet("Account information", OBJPROP_YDISTANCE, 45);
   ObjectSetText("Account information","=====Account information=====",10,"Arial",PanelTextColor);
  
   ObjectCreate("Balance", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Balance", OBJPROP_CORNER, 0);
   ObjectSet("Balance", OBJPROP_XDISTANCE, 15);
   ObjectSet("Balance", OBJPROP_YDISTANCE, 60);

   ObjectCreate("Profit/DD", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Profit/DD", OBJPROP_CORNER, 0);
   ObjectSet("Profit/DD", OBJPROP_XDISTANCE, 15);
   ObjectSet("Profit/DD", OBJPROP_YDISTANCE, 75);
  
   ObjectCreate("Max DD", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Max DD", OBJPROP_CORNER, 0);
   ObjectSet("Max DD", OBJPROP_XDISTANCE, 15);
   ObjectSet("Max DD", OBJPROP_YDISTANCE, 90);
  
   ObjectCreate("Equity", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Equity", OBJPROP_CORNER, 0);    
   ObjectSet("Equity", OBJPROP_XDISTANCE, 15);
   ObjectSet("Equity", OBJPROP_YDISTANCE, 105);

   ObjectCreate("Free margin", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Free margin", OBJPROP_CORNER, 0);    
   ObjectSet("Free margin", OBJPROP_XDISTANCE, 15);
   ObjectSet("Free margin", OBJPROP_YDISTANCE, 120);
  
   ObjectCreate("Pair information", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Pair information", OBJPROP_CORNER, 0);    
   ObjectSet("Pair information", OBJPROP_XDISTANCE, 15);
   ObjectSet("Pair information", OBJPROP_YDISTANCE, 150);
   ObjectSetText("Pair information","=======Pair information======",10,"Arial",PanelTextColor);
  
   ObjectCreate("Pair", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Pair", OBJPROP_CORNER, 0);    
   ObjectSet("Pair", OBJPROP_XDISTANCE, 15);
   ObjectSet("Pair", OBJPROP_YDISTANCE, 165);
   ObjectSetText("Pair","Pair: "+Symbol(),10,"Arial",PanelTextColor);

   ObjectCreate("Margin required", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Margin required", OBJPROP_CORNER, 0);    
   ObjectSet("Margin required", OBJPROP_XDISTANCE, 15);
   ObjectSet("Margin required", OBJPROP_YDISTANCE, 180);

   ObjectCreate("Price pips", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Price pips", OBJPROP_CORNER, 0);    
   ObjectSet("Price pips", OBJPROP_XDISTANCE, 15);
   ObjectSet("Price pips", OBJPROP_YDISTANCE, 195);

   ObjectCreate("Spread", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Spread", OBJPROP_CORNER, 0);    
   ObjectSet("Spread", OBJPROP_XDISTANCE, 15);
   ObjectSet("Spread", OBJPROP_YDISTANCE, 210);

   ObjectCreate("Leverage", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Leverage", OBJPROP_CORNER, 0);    
   ObjectSet("Leverage", OBJPROP_XDISTANCE, 15);
   ObjectSet("Leverage", OBJPROP_YDISTANCE, 225);
//---
   return(INIT_SUCCEEDED);
  }

void start()
{
   //Расчет максимальной просадки
   if (AccountProfit()<0)
   {
      if (AccountProfit()<MaxDD)
         MaxDD=AccountProfit();
   }
  
   ObjectSetText("Balance","Balance: "+DoubleToString (AccountBalance(),2)+" "+AccountCurrency(),10,"Arial",PanelTextColor);
   ObjectSetText("Profit/DD","Profit/DD: "+DoubleToString (AccountProfit(),2)+" ("+DoubleToString((AccountProfit()*100)/AccountBalance(),2)+"%)",10,"Arial",PanelTextColor);
   ObjectSetText("Max DD","Max DD: "+DoubleToString (MaxDD,2)+" ("+DoubleToString((MaxDD*100)/AccountBalance(),2)+"%)",10,"Arial",PanelTextColor);
   ObjectSetText("Equity","Equity: "+DoubleToString (AccountEquity(),2),10,"Arial",PanelTextColor);
   ObjectSetText("Free margin","Free margin: "+DoubleToString (AccountFreeMargin(),2),10,"Arial",PanelTextColor);
   ObjectSetText("Margin required","Margin required: "+DoubleToString(MarketInfo(Symbol(), MODE_MARGINREQUIRED), 2)+" $",10,"Arial",PanelTextColor);
   ObjectSetText("Price pips","Price pips: "+DoubleToString(MarketInfo(Symbol(), MODE_TICKVALUE), 2)+" $",10,"Arial",PanelTextColor);
   ObjectSetText("Spread","Spread: "+DoubleToString(MarketInfo(Symbol(),MODE_SPREAD),2),10,"Arial",PanelTextColor);
   ObjectSetText("Leverage","Leverage: 1:"+IntegerToString(AccountLeverage(), 0),10,"Arial",PanelTextColor);
}

Everything works, displays the information correctly, but as soon as you restart the terminal, the panel stops working (writes that the balance is 0 and the rest of the information stops updating and freezes on one position, simply hangs up). How to combat this?

A screenshot is attached:
Files:
 
ilnur17021992:

I wrote a small info panel:

extern string     Display                    = "Настройки отображения"; //Display
extern color      PanelBackgroundColor       = Black;
extern color      PanelTextColor             = White;

double MaxDD;

int OnInit()
  {
//--- indicator buffers mapping
  
   ObjectCreate("Background", OBJ_RECTANGLE_LABEL, 0, 0, 0);
   ObjectSet("Background", OBJPROP_CORNER, 0);
   ObjectSet("Background", OBJPROP_XDISTANCE, 5);
   ObjectSet("Background", OBJPROP_YDISTANCE, 35);
   ObjectSet("Background", OBJPROP_XSIZE, 215);
   ObjectSet("Background", OBJPROP_YSIZE, 220);  
   ObjectSet("Background", OBJPROP_BGCOLOR, PanelBackgroundColor);
  
   ObjectCreate("Account information", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Account information", OBJPROP_CORNER, 0);
   ObjectSet("Account information", OBJPROP_XDISTANCE, 15);
   ObjectSet("Account information", OBJPROP_YDISTANCE, 45);
   ObjectSetText("Account information","=====Account information=====",10,"Arial",PanelTextColor);
  
   ObjectCreate("Balance", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Balance", OBJPROP_CORNER, 0);
   ObjectSet("Balance", OBJPROP_XDISTANCE, 15);
   ObjectSet("Balance", OBJPROP_YDISTANCE, 60);

   ObjectCreate("Profit/DD", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Profit/DD", OBJPROP_CORNER, 0);
   ObjectSet("Profit/DD", OBJPROP_XDISTANCE, 15);
   ObjectSet("Profit/DD", OBJPROP_YDISTANCE, 75);
  
   ObjectCreate("Max DD", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Max DD", OBJPROP_CORNER, 0);
   ObjectSet("Max DD", OBJPROP_XDISTANCE, 15);
   ObjectSet("Max DD", OBJPROP_YDISTANCE, 90);
  
   ObjectCreate("Equity", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Equity", OBJPROP_CORNER, 0);    
   ObjectSet("Equity", OBJPROP_XDISTANCE, 15);
   ObjectSet("Equity", OBJPROP_YDISTANCE, 105);

   ObjectCreate("Free margin", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Free margin", OBJPROP_CORNER, 0);    
   ObjectSet("Free margin", OBJPROP_XDISTANCE, 15);
   ObjectSet("Free margin", OBJPROP_YDISTANCE, 120);
  
   ObjectCreate("Pair information", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Pair information", OBJPROP_CORNER, 0);    
   ObjectSet("Pair information", OBJPROP_XDISTANCE, 15);
   ObjectSet("Pair information", OBJPROP_YDISTANCE, 150);
   ObjectSetText("Pair information","=======Pair information======",10,"Arial",PanelTextColor);
  
   ObjectCreate("Pair", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Pair", OBJPROP_CORNER, 0);    
   ObjectSet("Pair", OBJPROP_XDISTANCE, 15);
   ObjectSet("Pair", OBJPROP_YDISTANCE, 165);
   ObjectSetText("Pair","Pair: "+Symbol(),10,"Arial",PanelTextColor);

   ObjectCreate("Margin required", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Margin required", OBJPROP_CORNER, 0);    
   ObjectSet("Margin required", OBJPROP_XDISTANCE, 15);
   ObjectSet("Margin required", OBJPROP_YDISTANCE, 180);

   ObjectCreate("Price pips", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Price pips", OBJPROP_CORNER, 0);    
   ObjectSet("Price pips", OBJPROP_XDISTANCE, 15);
   ObjectSet("Price pips", OBJPROP_YDISTANCE, 195);

   ObjectCreate("Spread", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Spread", OBJPROP_CORNER, 0);    
   ObjectSet("Spread", OBJPROP_XDISTANCE, 15);
   ObjectSet("Spread", OBJPROP_YDISTANCE, 210);

   ObjectCreate("Leverage", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Leverage", OBJPROP_CORNER, 0);    
   ObjectSet("Leverage", OBJPROP_XDISTANCE, 15);
   ObjectSet("Leverage", OBJPROP_YDISTANCE, 225);
//---
   return(INIT_SUCCEEDED);
  }

void start()
{
   //Расчет максимальной просадки
   if (AccountProfit()<0)
   {
      if (AccountProfit()<MaxDD)
         MaxDD=AccountProfit();
   }
  
   ObjectSetText("Balance","Balance: "+DoubleToString (AccountBalance(),2)+" "+AccountCurrency(),10,"Arial",PanelTextColor);
   ObjectSetText("Profit/DD","Profit/DD: "+DoubleToString (AccountProfit(),2)+" ("+DoubleToString((AccountProfit()*100)/AccountBalance(),2)+"%)",10,"Arial",PanelTextColor);
   ObjectSetText("Max DD","Max DD: "+DoubleToString (MaxDD,2)+" ("+DoubleToString((MaxDD*100)/AccountBalance(),2)+"%)",10,"Arial",PanelTextColor);
   ObjectSetText("Equity","Equity: "+DoubleToString (AccountEquity(),2),10,"Arial",PanelTextColor);
   ObjectSetText("Free margin","Free margin: "+DoubleToString (AccountFreeMargin(),2),10,"Arial",PanelTextColor);
   ObjectSetText("Margin required","Margin required: "+DoubleToString(MarketInfo(Symbol(), MODE_MARGINREQUIRED), 2)+" $",10,"Arial",PanelTextColor);
   ObjectSetText("Price pips","Price pips: "+DoubleToString(MarketInfo(Symbol(), MODE_TICKVALUE), 2)+" $",10,"Arial",PanelTextColor);
   ObjectSetText("Spread","Spread: "+DoubleToString(MarketInfo(Symbol(),MODE_SPREAD),2),10,"Arial",PanelTextColor);
   ObjectSetText("Leverage","Leverage: 1:"+IntegerToString(AccountLeverage(), 0),10,"Arial",PanelTextColor);
}

Everything works, displays the information correctly, but when you restart the terminal, the panel stops working (writes that the balance is 0, and the rest of the information stops updating and freezes on one position, simply hangs up). How to deal with it?

I'm attaching a screenshot:

Similar problem discussed not so long ago, have you looked at the log or expert tab, I can say with 100% certainty that you have a division by zero error in these lines

   ObjectSetText("Profit/DD","Profit/DD: "+DoubleToString (AccountProfit(),2)+" ("+DoubleToString((AccountProfit()*100)/AccountBalance(),2)+"%)",10,"Arial",PanelTextColor);
   ObjectSetText("Max DD","Max DD: "+DoubleToString (MaxDD,2)+" ("+DoubleToString((MaxDD*100)/AccountBalance(),2)+"%)",10,"Arial",PanelTextColor);


...

 
ilnur17021992:

I wrote a small info panel:

void start()
{
   //Расчет максимальной просадки
   if (AccountProfit()<0)
   {
      if (AccountProfit()<MaxDD)
         MaxDD=AccountProfit();
   }
  
   ObjectSetText("Balance","Balance: "+DoubleToString (AccountBalance(),2)+" "+AccountCurrency(),10,"Arial",PanelTextColor);
   ...
   ObjectSetText("Leverage","Leverage: 1:"+IntegerToString(AccountLeverage(), 0),10,"Arial",PanelTextColor);
}

Everything works, displays the information correctly, but as soon as you restart the terminal, the panel stops working (writes that the balance is 0 and the rest of the information stops updating and freezes on one position, simply hangs up). How to struggle with it?

Screenshot attached:

Try it like this:

void start()
{
   if (AccountBalance()<5) return; // <<< if (AccountBalance()==0) return;

   //Расчет максимальной просадки
   if (AccountProfit()<0)
   {
      if (AccountProfit()<MaxDD)
         MaxDD=AccountProfit();
   }
  
   ObjectSetText("Balance","Balance: "+DoubleToString (AccountBalance(),2)+" "+AccountCurrency(),10,"Arial",PanelTextColor);
   ...
   ObjectSetText("Leverage","Leverage: 1:"+IntegerToString(AccountLeverage(), 0),10,"Arial",PanelTextColor);
}
This problem is due to the fact that the connection to the server has not yet happened and there is no data on the account, so it divides by zero. Enter a simple check and if there is no connection then the balance will be zero - wait for connection and update.
 
ilnur17021992 :

Wrote a small info panel:

extern string      Display                    = "Настройки отображения" ; //Display
extern color       PanelBackgroundColor       = Black;
extern color       PanelTextColor             = White;



Everything works, the information is displayed correctly, but as soon as the terminal is restarted, the panel stops functioning (it says that the balance is 0, and the rest of the information stops updating and freezes in one position, it simply freezes). How to deal with it?

Screenshot attached:

I did a little magic on your panel. I got this code, I eliminated the error of division by zero .

//+------------------------------------------------------------------+
//|                                                   test_panel.mq4 |
//|                                                   Sergey Gritsay |
//|                         https://www.mql5.com/ru/users/sergey1294 |
//+------------------------------------------------------------------+
#property copyright "Sergey Gritsay"
#property link        "https://www.mql5.com/ru/users/sergey1294"
#property version    "1.00"
#property strict

sinput string      Display= NULL ; //Настройки отображения
input color       PanelBackgroundColor       = clrBlack ;
input color       PanelTextColor             = clrWhite ;
input color       ColorMinus= clrRed ;
input color ColorPlus= clrBlueViolet ;
input color ColorZero= clrMediumAquamarine ;

double balans= 0.0 ;
double profit= 0.0 ;
double profit_dd_procent= 0.0 ;
double MaxDD= 0.0 ;
double MaxDD_procent= 0.0 ;
double Equity= 0.0 ;
double Freemargin= 0.0 ;
double Marginrequired= 0.0 ;
double Pricepips= 0.0 ;
int Spread= 0 ;
int Leverage= 0 ;
string symbol= NULL ;
string currency= NULL ;

int X= 15 ;
int Y= 45 ;
int size= 15 ;
int x_sdvig= 150 ;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
  {
//---
   Refresh();
   Panel();
//---
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
//---
   RectLabelDelete( 0 , "Background" );
   LabelDelete( 0 , "Account information" );
   LabelDelete( 0 , "Balance" );
   LabelDelete( 0 , "Balance value" );
   LabelDelete( 0 , "Profit/DD" );
   LabelDelete( 0 , "Profit/DD value" );
   LabelDelete( 0 , "Max DD" );
   LabelDelete( 0 , "Max DD value" );

   LabelDelete( 0 , "Equity" );
   LabelDelete( 0 , "Equity value" );
   LabelDelete( 0 , "Free margin" );
   LabelDelete( 0 , "Free margin value" );
   LabelDelete( 0 , "Pair information" );
   LabelDelete( 0 , "Pair" );
   LabelDelete( 0 , "Pair value" );
   LabelDelete( 0 , "Margin required" );
   LabelDelete( 0 , "Margin required value" );
   LabelDelete( 0 , "Price pips" );
   LabelDelete( 0 , "Price pips value" );
   LabelDelete( 0 , "Spread" );
   LabelDelete( 0 , "Spread value" );
   LabelDelete( 0 , "Leverage" );
   LabelDelete( 0 , "Leverage value" );

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick ()
  {
//---
   Refresh();
   Panel();
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Refresh()
  {
   symbol= _Symbol ;
   currency= AccountInfoString ( ACCOUNT_CURRENCY );
   balans = AccountInfoDouble ( ACCOUNT_BALANCE );
   profit = AccountInfoDouble ( ACCOUNT_PROFIT );
   Equity = AccountInfoDouble ( ACCOUNT_EQUITY );
   Freemargin= AccountInfoDouble ( ACCOUNT_MARGIN_FREE );
   Marginrequired= MarketInfo (symbol, MODE_MARGINREQUIRED );
   Pricepips= SymbolInfoDouble (symbol, SYMBOL_TRADE_TICK_VALUE );
   Leverage=( int ) AccountInfoInteger ( ACCOUNT_LEVERAGE );
   double ask= SymbolInfoDouble (symbol, SYMBOL_ASK );
   double bid= SymbolInfoDouble (symbol, SYMBOL_BID );
   double point= SymbolInfoDouble (symbol, SYMBOL_POINT );
   Spread=( int ) SymbolInfoInteger (symbol, SYMBOL_SPREAD );
   if (Spread== 0 )Spread= int ((ask-bid)/point);
//Расчет максимальной просадки
   if (profit< 0 )
       if (profit<MaxDD)
         MaxDD=profit;
        
   if (balans!= 0 )
     {
      profit_dd_procent=profit* 100.0 /balans;
      MaxDD_procent=MaxDD* 100.0 /balans;
     }

  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Panel()
  {
   RectLabelCreate( 0 , "Background" , 0 , 5 , 35 , 300 , 230 ,PanelBackgroundColor);
   LabelCreate( 0 , "Account information" , 0 ,X,Y, "=====Account information=====" ,PanelTextColor);Y+=size;
   LabelCreate( 0 , "Balance" , 0 ,X,Y, "Balance (" +currency+ "):" ,PanelTextColor);
   LabelCreate( 0 , "Balance value" , 0 ,x_sdvig,Y, DoubleToString (balans, 2 ),ColorValue(balans));Y+=size;
   LabelCreate( 0 , "Profit/DD" , 0 ,X,Y, "Profit/DD (" +currency+ " / %):" ,PanelTextColor);
   LabelCreate( 0 , "Profit/DD value" , 0 ,x_sdvig,Y, DoubleToString (profit, 2 )+ " / " + DoubleToString (profit_dd_procent, 2 ),ColorValue(profit));Y+=size;
   LabelCreate( 0 , "Max DD" , 0 ,X,Y, "Max DD (" +currency+ " / %):" ,PanelTextColor);
   LabelCreate( 0 , "Max DD value" , 0 ,x_sdvig,Y, DoubleToString (MaxDD, 2 )+ " / " + DoubleToString (MaxDD_procent, 2 ),ColorValue(MaxDD));Y+=size;
   LabelCreate( 0 , "Equity" , 0 ,X,Y, "Equity (" +currency+ "):" ,PanelTextColor);
   LabelCreate( 0 , "Equity value" , 0 ,x_sdvig,Y,( string )Equity,ColorValue(Equity));Y+=size;
   LabelCreate( 0 , "Free margin" , 0 ,X,Y, "Free margin (" +currency+ "):" ,PanelTextColor);
   LabelCreate( 0 , "Free margin value" , 0 ,x_sdvig,Y,( string )Freemargin,ColorValue(Freemargin));Y+=size;Y+=size;

   LabelCreate( 0 , "Pair information" , 0 ,X,Y, "=======Pair information======" ,PanelTextColor);Y+=size;
   LabelCreate( 0 , "Pair" , 0 ,X,Y, "Pair:" ,PanelTextColor);
   LabelCreate( 0 , "Pair value" , 0 ,x_sdvig,Y,symbol,PanelTextColor);Y+=size;
   LabelCreate( 0 , "Margin required" , 0 ,X,Y, "Margin required (" +currency+ "):" ,PanelTextColor);
   LabelCreate( 0 , "Margin required value" , 0 ,x_sdvig,Y,( string )Marginrequired,ColorValue(Marginrequired));Y+=size;
   LabelCreate( 0 , "Price pips" , 0 ,X,Y, "Price pips (" +currency+ "):" ,PanelTextColor);
   LabelCreate( 0 , "Price pips value" , 0 ,x_sdvig,Y,( string )Pricepips,ColorValue(Pricepips));Y+=size;
   LabelCreate( 0 , "Spread" , 0 ,X,Y, "Spread:" ,PanelTextColor);
   LabelCreate( 0 , "Spread value" , 0 ,x_sdvig,Y,( string )Spread,ColorValue(Spread));Y+=size;
   LabelCreate( 0 , "Leverage" , 0 ,X,Y, "Leverage:" ,PanelTextColor);
   LabelCreate( 0 , "Leverage value" , 0 ,x_sdvig,Y, "1:" +( string )Leverage,PanelTextColor);
  }
//+------------------------------------------------------------------+
//| Создает прямоугольную метку                                      |
//+------------------------------------------------------------------+
bool RectLabelCreate( const long              chart_ID= 0 ,               // ID графика
                     const string            name= "RectLabel" ,         // имя метки
                     const int               sub_window= 0 ,             // номер подокна
                     const int               x= 0 ,                       // координата по оси X
                     const int               y= 0 ,                       // координата по оси Y
                     const int               width= 50 ,                 // ширина
                     const int               height= 18 ,                 // высота
                     const color             back_clr= C'236,233,216' ,   // цвет фона
                     const ENUM_BORDER_TYPE border= BORDER_SUNKEN ,     // тип границы
                     const ENUM_BASE_CORNER corner= CORNER_LEFT_UPPER , // угол графика для привязки
                     const color             clr= clrRed ,               // цвет плоской границы (Flat)
                     const ENUM_LINE_STYLE   style= STYLE_SOLID ,         // стиль плоской границы
                     const int               line_width= 1 ,             // толщина плоской границы
                     const bool              back= false ,               // на заднем плане
                     const bool              selection= false ,           // выделить для перемещений
                     const bool              hidden= true ,               // скрыт в списке объектов
                     const long              z_order= 0 )                 // приоритет на нажатие мышью
  {
//--- сбросим значение ошибки
   ResetLastError ();
//--- создадим прямоугольную метку
   if ( ObjectFind (chart_ID,name)!=sub_window)
     {
       if (! ObjectCreate (chart_ID,name, OBJ_RECTANGLE_LABEL ,sub_window, 0 , 0 ))
        {
         Print ( __FUNCTION__ ,
               ": не удалось создать прямоугольную метку! Код ошибки = " , GetLastError ());
         return ( false );
        }
     }
//--- установим координаты метки
   ObjectSetInteger (chart_ID,name, OBJPROP_XDISTANCE ,x);
   ObjectSetInteger (chart_ID,name, OBJPROP_YDISTANCE ,y);
//--- установим размеры метки
   ObjectSetInteger (chart_ID,name, OBJPROP_XSIZE ,width);
   ObjectSetInteger (chart_ID,name, OBJPROP_YSIZE ,height);
//--- установим цвет фона
   ObjectSetInteger (chart_ID,name, OBJPROP_BGCOLOR ,back_clr);
//--- установим тип границы
   ObjectSetInteger (chart_ID,name, OBJPROP_BORDER_TYPE ,border);
//--- установим угол графика, относительно которого будут определяться координаты точки
   ObjectSetInteger (chart_ID,name, OBJPROP_CORNER ,corner);
//--- установим цвет плоской рамки (в режиме Flat)
   ObjectSetInteger (chart_ID,name, OBJPROP_COLOR ,clr);
//--- установим стиль линии плоской рамки
   ObjectSetInteger (chart_ID,name, OBJPROP_STYLE ,style);
//--- установим толщину плоской границы
   ObjectSetInteger (chart_ID,name, OBJPROP_WIDTH ,line_width);
//--- отобразим на переднем (false) или заднем (true) плане
   ObjectSetInteger (chart_ID,name, OBJPROP_BACK ,back);
//--- включим (true) или отключим (false) режим перемещения метки мышью
   ObjectSetInteger (chart_ID,name, OBJPROP_SELECTABLE ,selection);
   ObjectSetInteger (chart_ID,name, OBJPROP_SELECTED ,selection);
//--- скроем (true) или отобразим (false) имя графического объекта в списке объектов
   ObjectSetInteger (chart_ID,name, OBJPROP_HIDDEN ,hidden);
//--- установим приоритет на получение события нажатия мыши на графике
   ObjectSetInteger (chart_ID,name, OBJPROP_ZORDER ,z_order);
//--- успешное выполнение
   return ( true );
  }
//+------------------------------------------------------------------+
//| Создает текстовую метку                                          |
//+------------------------------------------------------------------+
bool LabelCreate( const long               chart_ID= 0 ,               // ID графика
                 const string             name= "Label" ,             // имя метки
                 const int                sub_window= 0 ,             // номер подокна
                 const int                x= 0 ,                       // координата по оси X
                 const int                y= 0 ,                       // координата по оси Y
                 const string             text= "Label" ,             // текст
                 const color              clr= clrRed ,               // цвет
                 const string             font= "Arial" ,             // шрифт
                 const int                font_size= 10 ,             // размер шрифта
                 const double             angle= 0.0 ,                 // наклон текста
                 const ENUM_BASE_CORNER   corner= CORNER_LEFT_UPPER , // угол графика для привязки
                 const ENUM_ANCHOR_POINT anchor= ANCHOR_LEFT_UPPER , // способ привязки
                 const bool               back= false ,               // на заднем плане
                 const bool               selection= false ,           // выделить для перемещений
                 const bool               hidden= true ,               // скрыт в списке объектов
                 const long               z_order= 0 )                 // приоритет на нажатие мышью
  {
//--- сбросим значение ошибки
   ResetLastError ();
//--- создадим текстовую метку
   if ( ObjectFind (chart_ID,name)!=sub_window)
     {
       if (! ObjectCreate (chart_ID,name, OBJ_LABEL ,sub_window, 0 , 0 ))
        {
         Print ( __FUNCTION__ ,
               ": не удалось создать текстовую метку! Код ошибки = " , GetLastError ());
         return ( false );
        }
     }
//--- установим координаты метки
   ObjectSetInteger (chart_ID,name, OBJPROP_XDISTANCE ,x);
   ObjectSetInteger (chart_ID,name, OBJPROP_YDISTANCE ,y);
//--- установим угол графика, относительно которого будут определяться координаты точки
   ObjectSetInteger (chart_ID,name, OBJPROP_CORNER ,corner);
//--- установим текст
   ObjectSetString (chart_ID,name, OBJPROP_TEXT ,text);
//--- установим шрифт текста
   ObjectSetString (chart_ID,name, OBJPROP_FONT ,font);
//--- установим размер шрифта
   ObjectSetInteger (chart_ID,name, OBJPROP_FONTSIZE ,font_size);
//--- установим угол наклона текста
   ObjectSetDouble (chart_ID,name, OBJPROP_ANGLE ,angle);
//--- установим способ привязки
   ObjectSetInteger (chart_ID,name, OBJPROP_ANCHOR ,anchor);
//--- установим цвет
   ObjectSetInteger (chart_ID,name, OBJPROP_COLOR ,clr);
//--- отобразим на переднем (false) или заднем (true) плане
   ObjectSetInteger (chart_ID,name, OBJPROP_BACK ,back);
//--- включим (true) или отключим (false) режим перемещения метки мышью
   ObjectSetInteger (chart_ID,name, OBJPROP_SELECTABLE ,selection);
   ObjectSetInteger (chart_ID,name, OBJPROP_SELECTED ,selection);
//--- скроем (true) или отобразим (false) имя графического объекта в списке объектов
   ObjectSetInteger (chart_ID,name, OBJPROP_HIDDEN ,hidden);
//--- установим приоритет на получение события нажатия мыши на графике
   ObjectSetInteger (chart_ID,name, OBJPROP_ZORDER ,z_order);
//--- успешное выполнение
   return ( true );
  }
//+------------------------------------------------------------------+
//| Изменяет текст объекта                                           |
//+------------------------------------------------------------------+
bool LabelTextChange( const long    chart_ID= 0 ,   // ID графика
                     const string name= "Label" , // имя объекта
                     const string text= "Text" )   // текст
  {
//--- сбросим значение ошибки
   ResetLastError ();
//--- изменим текст объекта
   if (! ObjectSetString (chart_ID,name, OBJPROP_TEXT ,text))
     {
       Print ( __FUNCTION__ ,
             ": не удалось изменить текст! Код ошибки = " , GetLastError ());
       return ( false );
     }
//--- успешное выполнение
   return ( true );
  }
//+------------------------------------------------------------------+
//| Удаляет текстовую метку                                          |
//+------------------------------------------------------------------+
bool LabelDelete( const long    chart_ID= 0 ,   // ID графика
                 const string name= "Label" ) // имя метки
  {
//--- сбросим значение ошибки
   ResetLastError ();
//--- удалим метку
   if (! ObjectDelete (chart_ID,name))
     {
       Print ( __FUNCTION__ ,
             ": не удалось удалить текстовую метку! Код ошибки = " , GetLastError ());
       return ( false );
     }
//--- успешное выполнение
   return ( true );
  }
//+------------------------------------------------------------------+
//| Удаляет прямоугольную метку                                      |
//+------------------------------------------------------------------+
bool RectLabelDelete( const long    chart_ID= 0 ,       // ID графика
                     const string name= "RectLabel" ) // имя метки
  {
//--- сбросим значение ошибки
   ResetLastError ();
//--- удалим метку
   if (! ObjectDelete (chart_ID,name))
     {
       Print ( __FUNCTION__ ,
             ": не удалось удалить прямоугольную метку! Код ошибки = " , GetLastError ());
       return ( false );
     }
//--- успешное выполнение
   return ( true );
  }
//+------------------------------------------------------------------+
color ColorValue( double value)
  {
   if (value> 0 ) return (ColorPlus);
   if (value< 0 ) return (ColorMinus);
   return (ColorZero);
  }
//+------------------------------------------------------------------+


....

 
Sergey Gritsay:

I've done some work on your dashboard. I've got this code, the error of division by zero has been eliminated.

//+------------------------------------------------------------------+
//|                                                   test_panel.mq4 |
//|                                                   Sergey Gritsay |
//|                         https://www.mql5.com/ru/users/sergey1294 |
//+------------------------------------------------------------------+
#property copyright "Sergey Gritsay"
#property link      "https://www.mql5.com/ru/users/sergey1294"
#property version   "1.00"
#property strict


....

Well, it's in the form of EA, and most likely you need an indicator, because after installing this EA, you can't install an EA anymore and you have to choose, or install a trading EA, or an EA panel =)

 
Vitaly Muzichenko:

Well, this is in the form of an EA, and you most likely need an indicator, because after installing this EA, it will no longer be possible to install an EA, and you will have to choose, either to install a trading EA or an EA panel =)

It is not too difficult to copy this code into the indicator. There was no indication in the topiker's question that he was writing an indicator.
 
Sergey Gritsay:
It is not too difficult to copy this code into an indicator. There was no indication in the question that he was writing the indicator.
Many thanks to those who responded and helped. I am actually writing not just a "panel" but a full-featured interactive information panel in the form of an indicator for a grid robot:
 
Vladimir Karputov:

In the strategy tester, go to the "Optimisation" tab -

This is where the results of the optimisation will be displayed.

I have mt4 and i did it that way, nooptimisation graph and no results!