Possible to display comment with big size font and colour on chart?

 

Hi,

Is this possible to display the comment on chart with bold/big size font and different colour?

currently i used to display comments as normal. but i like to display header as bigger font with bold and ey-catch colour.

Please help me if there is any functions available to use?

currently i use:

{
    string temp = "SheriffOnline.com - Free MQL Code Service\nExecuted : " + Count + "\n"
    + "Spread: " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD)/PipValue, 2)+ "\n"
    + "------------------------------------------------\n"
    + "ACCOUNT INFORMATION:\n"
    + "\n"
    + "Account Name:     " + AccountName()+ "\n"
    + "Broker Name:     " + AccountCompany()+ "\n"
    + "Server Name:     " + AccountServer()+ "\n"
    + "Currency:     " + AccountCurrency()+ "\n"
    + "Account Leverage:     " + DoubleToStr(AccountLeverage(), 0)+ "\n"
    + "Account Balance:     " + DoubleToStr(AccountBalance(), 2)+ "\n"
    + "Account Equity:     " + DoubleToStr(AccountEquity(), 2)+ "\n"
    + "Free Margin:     " + DoubleToStr(AccountFreeMargin(), 2)+ "\n"
    + "Used Margin:     " + DoubleToStr(AccountMargin(), 2)+ "\n"
    + "Account Profit:     " + DoubleToStr(AccountProfit(), 2)+ "\n"
    + "------------------------------------------------\n";
    Comment(temp);
    Count++;
   
}
 
sheriffonline:

Hi,

Is this possible to display the comment on chart with bold/big size font and different colour?

currently i used to display comments as normal. but i like to display header as bigger font with bold and ey-catch colour.

Please help me if there is any functions available to use?

currently i use:

Change in Font ? No. Change in colour ? yes if you are happy to change the colour of the other chart elements that share the same colour, change the Foreground colour - F8

Alternatively use something like my CommentLab() function . . .

 

Hi,

this is what what i want to code.

see the image.

i would like to display the comments with specified colours and like to display the icon image.

Please give me best idea to start coding for this colurful comment display.


 
sheriffonline:

Hi,

this is what what i want to code.

see the image.

i would like to display the comments with specified colours and like to display the icon image.

Please give me best idea to start coding for this colurful comment display.


I did better than that, I gave you the code . . . did you click the link I gave ?
 
RaptorUK:
I did better than that, I gave you the code . . . did you click the link I gave ?


I try the code you have given,when i compile shows error.

2;116;67:20;'(' - function definition unexpected
2;75;88:9;'CommentLabel' - variable not defined
2;75;89:22;'CommentLabel' - variable not defined
2;75;90:19;'CommentLabel' - variable not defined
2;75;91:19;'CommentLabel' - variable not defined
2;75;92:19;'CommentLabel' - variable not defined
2;75;93:23;'CommentLabel' - variable not defined
2;75;93:63;'Status_Color' - variable not defined
2;73;97:1;'}' - unbalanced parentheses

void CommentLab(string CommentText)   
  {
   string CommentLabel;
   int CommentIndex = 0;
   
   if (CommentText == "")
      {
      //  delete all Comment texts
      while(ObjectFind(StringConcatenate("CommentLabel", CommentIndex )) >= 0)
         {
         ObjectDelete(StringConcatenate("CommentLabel", CommentIndex ));
         CommentIndex++;
         }
      return;
      }
   
   while(ObjectFind(StringConcatenate("CommentLabel", CommentIndex )) >= 0)
      {
      CommentIndex++;
      }
      
   CommentLabel = StringConcatenate("CommentLabel", CommentIndex);  
   ObjectCreate(CommentLabel, OBJ_LABEL, 0, 0, 0 );
   ObjectSet(CommentLabel, OBJPROP_CORNER, 0);
   ObjectSet(CommentLabel, OBJPROP_XDISTANCE, 5);
   ObjectSet(CommentLabel, OBJPROP_YDISTANCE, 15 + (CommentIndex * 15) );
   ObjectSetText(CommentLabel, CommentText, 10, "Tahoma", Status_Color );   
   
   }
 
sheriffonline:

I try the code you have given,when i compile shows error.

2;116;67:20;'(' - function definition unexpected
So fix your code. The problem is above the function definition.
 
sheriffonline:

I try the code you have given,when i compile shows error.

2;116;67:20;'(' - function definition unexpected
2;75;88:9;'CommentLabel' - variable not defined
2;75;89:22;'CommentLabel' - variable not defined
2;75;90:19;'CommentLabel' - variable not defined
2;75;91:19;'CommentLabel' - variable not defined
2;75;92:19;'CommentLabel' - variable not defined
2;75;93:23;'CommentLabel' - variable not defined
2;75;93:63;'Status_Color' - variable not defined
2;73;97:1;'}' - unbalanced parentheses


Status_Color is a globally declared color, have you added it ?

CommentLabel is a locally declared variable inside the function . . .

To use the Function do it like this:

CommentLab("This is a comment . . .");

or like this

CommentLab( StringConcatenate( "Ask price is: ", DoubleToStr(Ask, Digits) ) );
 
Simon Gniadkowski:


Status_Color is a globally declared color, have you added it ?

CommentLabel is a locally declared variable inside the function . . .

To use the Function do it like this:

or like this

the correct code is:


void CommentLab(string CommentText)  
{
   string CommentLabel;
   int CommentIndex = 0;
  
   if (CommentText == "")
   {
      //  delete all Comment texts
      while(ObjectFind(0,StringConcatenate(CommentLabel,"CommentLabel", CommentIndex )) >= 0)
      {
         ObjectDelete(0,StringConcatenate(CommentLabel,"CommentLabel", CommentIndex ));
         CommentIndex++;
      }
      return;
   }
  
   while(ObjectFind(0,StringConcatenate(CommentLabel,"CommentLabel", CommentIndex )) >= 0)
   {
      CommentIndex++;
   }
     
   CommentLabel = StringConcatenate(CommentLabel,"CommentLabel", CommentIndex); 

   ObjectCreate(0,CommentLabel, OBJ_LABEL, 0, 0, 0 );
   ObjectSetInteger(0,CommentLabel, OBJPROP_CORNER, 0);
   ObjectSetInteger(0,CommentLabel, OBJPROP_XDISTANCE, 5);
   ObjectSetInteger(0,CommentLabel, OBJPROP_YDISTANCE, 15 + (CommentIndex * 15) );
   ObjectSetInteger(0,CommentLabel, OBJPROP_COLOR, clrGoldenrod);  
//   ObjectSetInteger(0,CommentLabel, CommentText, 10, "Tahoma", Status_Color );  
  
}

 

Please use the </> button to insert your code.