초보자의 질문 MQL4 MT4 MetaTrader 4 - 페이지 53

 
Vitaly Muzichenko :

다음과 같이 다소:

좋습니다. 이익이 합산됩니다. 덕분에!
 

안녕하세요! 누가 해결책을 제안할 수 있습니까? M15에 입력된 코드가 있지만 H1의 신호가 고려됩니다. 신호가 H1에 매달려 있는 동안 M15의 표시기는 여러 신호를 제공합니다. 문제는 하나(즉, 첫 번째 신호)로 제한하는 것입니다.

k=0;
(i=OrdersTotal()-1;i>=0;i--)
{
새로 고침();
if( 주문 선택 (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 != 시간[0]) // 매도

 

작은 정보 패널 작성:

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);
}

모든 것이 작동하고 정보가 올바르게 표시되지만 터미널이 다시 시작되는 즉시 패널이 작동을 멈춥니다(잔액이 0이고 나머지 정보가 업데이트를 중지하고 한 위치에서 정지하면 단순히 정지됨). 그것을 처리하는 방법?

첨부된 스크린샷:
파일:
 
ilnur17021992 :

작은 정보 패널 작성:

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);
}

모든 것이 작동하고 정보가 올바르게 표시되지만 터미널이 다시 시작되는 즉시 패널이 작동을 멈춥니다(잔액이 0이고 나머지 정보가 업데이트를 중지하고 한 위치에서 정지하면 단순히 정지됨). 그것을 처리하는 방법?

첨부된 스크린샷:

얼마 전에 비슷한 문제가 논의되었습니다. 저널이나 전문가 탭을 살펴보니 이 줄에 0으로 나누기 오류가 있다고 100% 확신할 수 있습니다.

   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 :

작은 정보 패널 작성:

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);
}

모든 것이 작동하고 정보가 올바르게 표시되지만 터미널이 다시 시작되는 즉시 패널이 작동을 멈춥니다(잔액이 0이고 나머지 정보가 업데이트를 중지하고 한 위치에서 정지하면 단순히 정지됨). 그것을 처리하는 방법?

첨부된 스크린샷:

다음과 같이 시도하십시오.

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);
}
이 문제는 아직 서버와의 연결 이 이루어지지 않았고 계정에 데이터가 없기 때문에 0으로 나눕니다. 간단한 확인을 입력하고 연결이 없으면 잔액은 0이 됩니다. 연결 및 업데이트를 기다리고 있습니다.
 
ilnur17021992 :

작은 정보 패널 작성:

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



모든 것이 작동하고 정보가 올바르게 표시되지만 터미널이 다시 시작되는 즉시 패널이 작동을 멈춥니다(잔액이 0이고 나머지 정보가 업데이트를 중지하고 한 위치에서 정지하면 단순히 정지됨). 그것을 처리하는 방법?

첨부된 스크린샷:

나는 당신의 패널에 약간의 마법을 걸었습니다. 이 코드를 얻었고 0으로 나누는 오류를 제거했습니다.

//+------------------------------------------------------------------+
//|                                                   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 :

나는 당신의 패널에 약간의 마술을했습니다. 나는이 코드를 얻었고 0으로 나누는 오류를 제거했습니다.

//+------------------------------------------------------------------+
//|                                                   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


....

글쎄, 이것은 고문의 형태이지만, 이 고문을 설치한 후에는 더 이상 고문을 설치할 수 없고 거래 고문을 선택하거나 설치해야 하기 때문에 지표가 필요할 가능성이 큽니다. 고문 패널 =)

 
Vitaly Muzichenko :

글쎄, 이것은 고문의 형태이지만, 이 고문을 설치한 후에는 더 이상 고문을 설치할 수 없고 거래 고문을 선택하거나 설치해야 하기 때문에 지표가 필요할 가능성이 큽니다. 고문 패널 =)

이 코드를 표시기에 복사하는 것은 어렵지 않습니다. 토픽마스터의 질문에는 그가 지표를 쓰고 있다는 표시가 없었습니다.
 
Sergey Gritsay :
이 코드를 표시기에 복사하는 것은 어렵지 않습니다. 토픽마스터의 질문에는 그가 지표를 쓰고 있다는 표시가 없었습니다.
답변해주시고 도와주신 분들께 진심으로 감사드립니다. 사실 저는 "패널"이 아니라 그리드 로봇에 대한 표시기 형태의 완전한 기능을 갖춘 대화형 정보 패널 을 작성하고 있습니다.
 
Vladimir Karputov :

전략 테스터에서 "최적화" 탭으로 이동합니다.

최적화 결과가 있을 것입니다.

글쎄, 나는 MT4를 가지고 있고 최적화 차트 도 결과도 하지 않았다!