• Sign up >>

Creating text objects

To add comments, please log in or register
Nurudeen Amedu
38818
Nurudeen Amedu  

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


}
Ernst Van Der Merwe
6731
Ernst Van Der Merwe  

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


}
Stephen Neale
322
Stephen Neale  
Ernst Van Der Merwe:

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

Comment("\nShow it here: ",Trade)
Mohammad Soubra
31042
Mohammad Soubra  

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
Ernst Van Der Merwe
6731
Ernst Van Der Merwe  
Mohammad Soubra:

You can also use the function similar to this below:

 

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

You can also use the function similar to this below:

 

how do i write this
To add comments, please log in or register