Download MetaTrader 5
To add comments, please log in or register
Order a robot or an indicator for MetaTrader. The Freelance service will help you!
Frenchytrader
281
Frenchytrader 2014.04.17 20: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

Carl Schreiber
5940
Carl Schreiber 2014.04.17 20: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;
        ObjectDelete(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
281
Frenchytrader 2014.04.17 22:57  
Thank you, but I can't use it
Toast
220
Toast 2014.04.18 06: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.

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.04.18 07:36  
Good. You are able to differentiate the object usage. :)
Frenchytrader
281
Frenchytrader 2014.04.18 09:19  
I got it...Thank you
/
To add comments, please log in or register