程序库: CComment 类 - 页 2

 
您好,

,我在MQL5 代码库 2015.10.12 中免费下载了 "avoitenko "为 MetaTrader 5 编写的 "CComment Class "库,以便以简单的方式显示一些信息。

,我有两个问题。

1)面板不在图表的最前面,有些行在上面 - 为什么会这样,有没有办法改变它,使评论面板每次都在前面?



2) 正如您在我的示例代码中看到的,一些文本应该有不同的颜色,但字体颜色总是一样的,我不知道我做错了什么?
//For Commentsettings
#define  COLOR_BACK      clrBlack
#define  COLOR_BORDER    clrDimGray
#define  COLOR_CAPTION   clrDodgerBlue
#define  COLOR_TEXT      clrRed
#define  COLOR_WIN       clrLimeGreen
#define  COLOR_LOSS      clrOrangeRed

//OnInit() i do
 //面板设置
   int y=30;
   if(ChartGetInteger(0,CHART_SHOW_ONE_CLICK))
      y=120;
   //--- 面板名称
   srand(GetTickCount());
   string name="panel_"+IntegerToString(rand());
   comment.Create(name,20,y);
   //--- 面板样式
   comment.SetAutoColors(InpAutoColors);
   comment.SetColor(clrBlue,clrYellow,255);
   comment.SetFont("Lucida Console",13,false,1.7);
   //---
   //comment.SetText(0,StringFormat("Expert: %s v.%s", "MYNAME", "My_version"),COLOR_CAPTION);
   comment.SetText(0,"ANALYZER - Report (max poss. profit/loss)",COLOR_CAPTION);
   comment.SetText(1,"wait for datas....",clrWhite);
     
   comment.SetText(21,"coming soon...",clrWhite);
   comment.SetText(22,"Profitfaktor: XY - Tendenz +/-",clrWhite);
   comment.SetText(23,"输入信号的质量:XY VS wie nah am Tief/Hoch/Wendepunkt",clrWhite);
   comment.SetText(24,"出口信号质量:XY VS max-possible",clrWhite);
   comment.SetText(25,"细节:编队、蜡烛、Unterstützungslinien、Pivotpunkte......",clrWhite);
   comment.Show();


//ontick i do for example this to change/update line 17
string test1="my content";
comment_class_update(17,test1+" Text...",COLOR_TEXT);

// 文本将更新,但不是给定的颜色 - 在本例中应该是红色 ...



Arpit T #:
m_name=NULL; m_font_name="Lucida Console";m_font_size=14;m_font_bold=false; m_font_interval=1.7;m_border_color=clrNONE;m_back_color=clrBlack;m_back_alpha=255;// look at thism_graph_mode=true;m_auto_colors=falsem_chart_back_color=(color)ChartGetInteger(0,CHART_COLOR_BACKGROUND); // look at thism_auto_back_color=clrBlackm_auto_border_color=clrNONE;//--- ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,true);

你好,

这是我的部分,看起来可以吗?

void  CComment(void)
     {
      m_name=NULL;
      m_font_name="Lucida Console";
      m_font_size=14;
      m_font_bold=false;
      m_font_interval=1.7;
      m_border_color=clrAzure;
      m_back_color=clrBlack;
      m_back_alpha=255;
      m_graph_mode=true;
      m_auto_colors=false;
      m_chart_back_color=(color)ChartGetInteger(0,CHART_COLOR_BACKGROUND);
      m_auto_back_color=clrLightYellow;
      m_auto_border_color=clrYellow;
      //---
      ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,true);
      
      
      
     };

作者不再支持该类,这就是我使用论坛的原因。也许有什么类我可以用,但我找不到......?

[删除]  

分析类的功能,如

  void  CComment(void)
     {
      m_name=NULL;
      m_font_name="Lucida Console";
      m_font_size=14;
      m_font_bold=false;
      m_font_interval=1.7;
      m_border_color=clrNONE;
      m_back_color=clrBlack;
      m_back_alpha=255; // look at this
      m_graph_mode=true;
      m_auto_colors=false;
      m_chart_back_color=(color)ChartGetInteger(0,CHART_COLOR_BACKGROUND); // look at this
      m_auto_back_color=clrBlack;
      m_auto_border_color=clrNONE;
      //---
      ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,true);
     };

如果您在 "评论类 "代码库页面发布该问题,那么它将会得到作者的关注,您可能会得到更多更好的答案。



ReLor2 #:

你好,

这是我的部分,看起来可以吗?

作者不再支持该类,这就是我使用论坛的原因。也许有某种类我可以使用,但我找不到......?

请阅读这篇文章,它比 CComment 类要好得多。

https://www.mql5.com/zh/articles/13179

Making a dashboard to display data in indicators and EAs
Making a dashboard to display data in indicators and EAs
  • www.mql5.com
In this article, we will create a dashboard class to be used in indicators and EAs. This is an introductory article in a small series of articles with templates for including and using standard indicators in Expert Advisors. I will start by creating a panel similar to the MetaTrader 5 data window.
 
非常棒,非常轻便。谢谢!