Adding multiple comments

Rami Khattab  

HELLO,

 IM LEARNING MQL5, BELOW IS SIMPLE SCRIPT THAT SHOWS IF CANDLE (1) CLOSE {ABOVE/BELOW} THE {HIGH/LOW} OF CANDLE(2).  

HOWEVER IT IS SHOWING ONLY ONE COMMENT ON CHART, IT IS SUPPOSED TO COMMENT 2 ORDERS.

MUCH APPRECIATED FOR ANYHELP :)


void OnStart()

  {

  // FIRST CANDLE  1

  double high = iHigh(_Symbol,PERIOD_MN1,1);

  double low = iLow(_Symbol,PERIOD_MN1,1);

  double close = iClose(_Symbol,PERIOD_MN1,1);

  

  // SECOND CANDLE 2

  double high1 = iHigh(_Symbol,PERIOD_MN1,2);

  double low1 = iLow(_Symbol,PERIOD_MN1,2);

  double close1 = iClose(_Symbol,PERIOD_MN1,2);

  

  if (close > high1){

   Comment("UPWARD"); 

   }else{ 

   Comment("NOT UPWARD");

  }

   if (close < low1){

   Comment("DOWNWARD");

   }else{ 

   Comment("NOT DOWNWARD");

  }

   }
Thank-god Avwerosuoghene Odukudu  
Concatenate(add) all comments to a string, then output that comment 

string display ="";
  if (close > high1){
   display+= "UPWARD "; 
   }else{ 
   display+="NOT UPWARD ";
  }

   if (close < low1){
   display+="DOWNWARD";
   }else{ 
   display+="NOT DOWNWARD";
  } 
Comment( display );
The above can also be performed with stringconcatenate() functionLook it up in the reference guide.
Rami Khattab  
Thank-god Avwerosuoghene Odukudu #:
Concatenate(add) all comments to a string, then output that comment 

it worked thank you very much ;)

one more question if possible, the comments are shown in the same line,ex: UPWARD NOT DOWNARD
Can i show them on vertical line,ex :      UPWARD

                                                                 NOT DOWNARD

William Roeder  
Thank-god Avwerosuoghene Odukudu #: The above can also be performed with stringconcatenate() function.
Simplified
string display = (close > high1 ? "UPWARD "  : "NOT UPWARD ")
               +  close < low1  ? "DOWNWARD" : "NOT DOWNWARD";
Comment( display );
Thank-god Avwerosuoghene Odukudu  
Rami Khattab #:

it worked thank you very much ;)

one more question if possible, the comments are shown in the same line,ex: UPWARD NOT DOWNARD
Can i show them on vertical line,ex :      UPWARD

                                                                 NOT DOWNARD

Sure, use "\n" == New line. Google escape sequences for better understanding.

// Therefore having something like 
      display += "UPWARDS \n";


William Roeder #:
Simplified
string display = (close > high1 ? "UPWARD "  : "NOT UPWARD ")
               +  close < low1  ? "DOWNWARD" : "NOT DOWNWARD";
Comment( display );

nice simplification, but I feel it is easier for someone with some experience, the OP, registered not quite long

Reason: