How to place comments in a row?

 
int OnInit()
  {
 Comment ("Today is" , DayOfWeek()); Comment ("Balance =" , AccountBalance()); 

   return(INIT_SUCCEEDED);
  }

After entering this code I get this: (screenshot) 

I want "Today is" and "Balance" to be written in a row. How can I do that? 



(c) Sorry for stupid question, I am totally newbie

Files:
 
IgorFX Trading:

After entering this code I get this: (screenshot) 

I want "Today is" and "Balance" to be written in a row. How can I do that?

(c) Sorry for stupid question, I am totally newbie

Do you mean "multiple lines"?

Forum on trading, automated trading systems and testing trading strategies

How to write a new line in Comment()

Mladen Rakic, 2018.09.15 22:51

Add "\n" for each new line break that you want to insert

Ie:

Comment("first line\n"+
        "second line\n"+
        "third line\n"+
        "...\n"+
        "nth line");
 
Fernando Carreiro #:

Do you mean "multiple lines"?

Probably yes. But my EA doesn't open in MT4 after compilation. No errors, but warnings. Because of it?

 
IgorFX Trading #: Probably yes. But my EA doesn't open in MT4 after compilation. No errors, but warnings. Because of it?

Show your new code! We can't read your mind.

Please note, that you can only use one Comment() to display the entire text. If you call it a second time with different text, it will not add to it. It will replace it. Look at the examples above.

 
IgorFX Trading:

After entering this code I get this: (screenshot) 

I want "Today is" and "Balance" to be written in a row. How can I do that? 



(c) Sorry for stupid question, I am totally newbie

Comment(str1,str2);
Multiple rows?
Comment(str1,"\n",str2)

or
msg=StringConcatenate(str1,str2);
Comment(msg);

I use StringConcatenate if I need to build a string from a loop. But probably better ways..


 
IgorFX Trading: I want "Today is" and "Balance" to be written in a row. How can I do that? 
You were close.
 Comment ("Today is" , DayOfWeek()); Comment ("Balance =" , AccountBalance()); 
One comment, not two.
 Comment ("Today is" , DayOfWeek()      ,     "Balance =" , AccountBalance()); 
or this (you want balance to be two digits).
string output=StringFormat("Today is %d Balance =%.2f", DayOfWeek(), AccountBalance() );
Comment(output);