Create Objet

Back to topics list To post a new topic, please log in or register
FrenchyTrader 2014.04.17 22:53

Hi all,

Here the code I use to insert data

  ObjectCreate("txt_0",OBJ_TEXT,0,TimeCurrent() -100, Close[0] + 140 * Point);   
   ObjectSetText("txt_0", "Example", 14, "Times New Roman", Orange);
   ObjectMove("txt_0", 0, TimeCurrent() - 100, Close[0] + 140 * Point);

I would need to insert data on screen which you be fixed.

If I don't use ObjectMove(..) function, while the chart is running, the data will disapear.

Can anyone could provide an example how to display fixed data?

Thank you

gooly 2014.04.17 22:58 #

I am using something like this:

void showTxt(string line0) {
        static string lable1= "";
        if ( lable1 == "" )
                lable1 = plcTxtLabel("Lab1", 10, 5, 3);
        ObjectSetText(lable1, line0, 10, "Tahoma", clr);

string plcTxtLabel(string n, int x, int y, int corner) {
        n = idEA + n;
   ObjectCreate(n, OBJ_LABEL, 0, 0, 0);
   ObjectSet(n, OBJPROP_CORNER, corner);
   ObjectSet(n, OBJPROP_XDISTANCE, x);
   ObjectSet(n, OBJPROP_YDISTANCE, y);
   ObjectSet(n, OBJPROP_BACK, FALSE);
   return (n);

It is not really the original code so it is not tested nor compiled but might give you a hint..

FrenchyTrader 2014.04.18 00:57 #
Thank you, but I can't use it
toast 2014.04.18 08:49 #

As gooly has alluded to:

You are using OBJ_TEXT. These objects are fixed to a point in time. So as time progresses on the chart, your object will disappear off the screen to the left.

If you use OBJ_LABEL, you set the position relative to the window. This means the object does not move, even as time progresses.

deysmacro 2014.04.18 09:36 #
Good. You are able to differentiate the object usage. :)
FrenchyTrader 2014.04.18 11:19 #
I got it...Thank you
Back to topics list  

To add comments, please log in or register