Multiple Lines using Comment()

 

Hello all,

I am wondering if there is a way to get multiple lines of text using Comment(). I have tried to search, but no luck so far.

Thanks in advance,

LW

 

EX)

bjectCreate("Line1",OBJ_HLINE,0,0,1.37240);

bjectCreate("Line2",OBJ_HLINE,0,0, );

bjectCreate("Line3",OBJ_HLINE,0,0, );

bjectCreate("Line4",OBJ_HLINE,0,0, );

ok?

 
LeagueORobots:

Hello all,

I am wondering if there is a way to get multiple lines of text using Comment(). I have tried to search, but no luck so far.

Thanks in advance,

LW

You just need to include a newline character in your text string. The newline is "\n" as a string so you might say

Comment("Hello\nWorld");
 
LeagueORobots:

Hello all,

I am wondering if there is a way to get multiple lines of text using Comment(). I have tried to search, but no luck so far.

Thanks in advance,

LW


#define NL                 "\n"         // <--- add this at the top of your ea or subsitute \n for NL on all the lines

    
Comment("MagicNumber1 = " + MagicNumber1 + NL +            
        "MagicNumber2 = " + MagicNumber2 + NL +
        ".................................................................." + NL +
        "Total Number of Main Trades = " + MainTrade + NL + 
        "Total Number of Main Trades Profit = " + MWin + NL +
        "Total Number of Main Trades Loss = " +   MLoss + NL +
        ".................................................................." + NL +
        "Total Number of Sub Trades = " +  SubTrade + NL +
        "Total Number of Sub Profit = " +  SWin + NL +
        "Total Number of Sub Loss = " +    SLoss + NL +
        "......................................................................................................" + NL +
        "Sub Trades Win % (Sub Trade win vs total Sub Trades) = "+ (SWin*100)/SubTrade+"%"+ NL +
        "Main Trade win % (Main wins vs total Main Trade) =  "+ (MWin*100)/(MainTrade)+"%"+ NL +
        "Sub Trades % to Main Trades (Total Sub Trades vs Main Trades) = "+ (SubTrade*100)/(MainTrade)+"%"+ NL +
        "......................................................................................................");
 
string line1 = "this is line one",
       line2 = "below that is line two",
       line3 = "you get the idea";
Comment(line1+"\n",
        line2+"\n",
        line3+"\n");
 
Ha, 3 replies, in the same minute.
 

Something I knocked up last week, I noticed Comment couldn't keep up in the Strategy Tester and was falling behind, in other words, it was slow in putting messages on screen and wasn't able to put the correct message on screen when I did an automatic Chart Grab . . . so I created this, it was a bit of a rush job but it did what I wanted.

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 );   
   
   }
 
Thank you all for the help.
 
int OnInit()
  {
  
//---
  
  
   int num=SymbolsTotal(true);
   for(int i=0;i<num;i++){
      string name=SymbolName(i,True);
      double stoc=iStochastic(name,0,8,3,3,0,0,MODE_MAIN,1);
      
         while(stoc<20)
         Comment(name+"\n");
         
         //continue;
        
     }    
         

hi

i want wright market watch and filter stoch below 20 percent

and comment in chart but it only print 1 symbol 

please help me

Files:
Capture.PNG  119 kb
 
Simon Gniadkowski:

Something I knocked up last week, I noticed Comment couldn't keep up in the Strategy Tester and was falling behind, in other words, it was slow in putting messages on screen and wasn't able to put the correct message on screen when I did an automatic Chart Grab . . . so I created this, it was a bit of a rush job but it did what I wanted.

How can I use this??

 
Saeid Reza Bahman Abadi: and comment in chart but it only print 1 symbol
Of course, it does; last Comment is what you see. Create an empty string, append each line to the string, show the completed result.
Reason: