Multiple Lines using Comment()

Back to topics list To post a new topic, please log in or register
avatar
6
LeagueORobots 2012.03.02 20:35
 

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

 
avatar
17
tdmin79 2012.03.02 20:47 #
 

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?

 
avatar
1001
dabbler 2012.03.02 21:04 #
 
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");


 
avatar
123
danjp 2012.03.02 21:04 #
 
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 +
        "......................................................................................................");
avatar
13001
WHRoeder 2012.03.02 21:04 #
 
string line1 = "this is line one",
       line2 = "below that is line two",
       line3 = "you get the idea";
Comment(line1+"\n",
        line2+"\n",
        line3+"\n");

avatar
13001
WHRoeder 2012.03.02 21:06 #
 
Ha, 3 replies, in the same minute.
avatar
14167
RaptorUK 2012.03.02 22:25 #
 

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 );   
   
   }

 
avatar
6
LeagueORobots 2012.03.27 18:26 #
 
Thank you all for the help.
Back to topics list  

To add comments, please log in or register