Creating text objects

 

Hello all, i am trying to work with text objects, i want to create and align a line of text to the top left, please tell me how i can do it

i tried this but nothing showed up

and am putting the code in an indicator, not an EA 

void CreateObject(){
   ObjectCreate(0,"Trade",OBJ_TEXT,0,TimeCurrent(),0);
   ObjectSetText("Trade","Buy",9,"Arial Bold",clrBlue);
   ObjectSetDouble(0,"Trade",OBJPROP_ANGLE,ALIGN_LEFT);


}
 

It's better to set coordinates after object is created.

   void CreateObject(){
      ObjectCreate(0,"Trade",OBJ_TEXT,0,0,0);
      int first=(int)ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR)-3;
      double max=WindowPriceMax()-50*Point;
      ObjectSetInteger(0,"Trade",OBJPROP_TIME1,Time[first]);
      ObjectSetDouble(0,"Trade",OBJPROP_PRICE1,max);
      ObjectSetText("Trade","Buy",9,"Arial",clrBlue);
      ObjectSetDouble(0,"Trade",OBJPROP_ANGLE,ALIGN_LEFT);


}
 
Ernst Van Der Merwe:

It's better to set coordinates after object is created.

Comment("\nShow it here: ",Trade)
 

You can also use the function similar to this below:

 

ObjectSet(txtName,OBJPROP_CORNER,1);
//0: Top Left on the chart
//1: Top Right on the chart
//2: Low Left on the chart
//3: Low Right on the chart
 
Mohammad Soubra:

You can also use the function similar to this below:

 

Only works on label, button and edit objects.
 
Mohammad Soubra:

You can also use the function similar to this below:

 

how do i write this
Reason: