help regarding comments mql4

 

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


 
if (condition1 && condition2)
   Comment(abc + "\n" + xyz);

else if (condition1)
   Comment(abc);

else if (condition2)
   Comment(xyz);
 

If you have really long conditions you could also do something like. 

   string line[]={"","\n"};
   string comm="";
   int cnt=0;
   if(condition1)
   {
      cnt++;
      comm = "abc";
   }
   if(condition2)
      comm+= line[cnt]+"xyz";
   Comment(comm);
 
nicholishen: If you have really long conditions you could also do something like. 

Code breaks with more than two conditions. The array is unnecessary.

   string comm="";  #define NL '\n'
   if(condition1)  comm += "C1" + NL;
   if(condition2)  comm += "C2" + NL;
   :
   Comment(comm);
 
whroeder1:

Code breaks with more than two conditions. The array is unnecessary.


Agreed. I don't know what I was thinking. Need more coffee. This is much better. Good job.

Reason: