Function Comment() overwrites Comments written before - page 2

 
Dadas:

Still, a Label is not a Comment and a Comment is not a Label.

That is true . . . and Comment() always overwrites and existing comment.
 
RaptorUK:
That is true . . . and Comment() always overwrites and existing comment.


Thanks anyway!

Thanks to You RaptorUK, I have just learned to use StringConcatenate()!

Every time I learn smth new!

BTW, I agree that using Label instead of Comment is better.

You can place the Label anywhere you want on the chart.

I use o lot of Label in my EA.

Also, could you look at my new thread: https://www.mql5.com/en/forum/140884

I still need a solution for that.

 

Hello friends :-)

I  need some help regarding comments in mql4.

 below is my code

If (condition1)

{

Comment(abc)

}



If (condition2)

{

Comment(xyz)

}



The exact problem is if both condition is true at same time , i get only only 1 comment in upper left corner..

I need both comments in 2 lines

Please suggest ideas.Thanks


 
Sivabharani Kumar:

Hello friends :-)

I  need some help regarding comments in mql4.

 below is my code

If (condition1)

{

Comment(abc)

}



If (condition2)

{

Comment(xyz)

}



The exact problem is if both condition is true at same time , i get only only 1 comment in upper left corner..

I need both comments in 2 lines

Please suggest ideas.Thanks


Use different function or merge the abc and xyz into a single string before outputting it wit the Comment() function
 

Hello everyone,

Just reset the condition to true if the other condition is false via versa. turn both to false if both conditions exit.

 
  1. Don't double post!
              General rules and best pratices of the Forum. - General - MQL5 programming forum

  2. string comm="";  #define NL '\n'
    if(condition1) comm += "condition1" + NL;
    if(condition2) comm += "condition2" + NL;
    :
    comment(comm);
 

I just learnt and would like to share. Thanks to the community.

Use static string variable and add to the static string variable every time condition is true.