Text labels on Horizontal Lines

 

Hi,

I wonder if anyone can help.

I have made an indicator which plots horizontal lines on a chart. Each line has a label using the following code:

ObjectCreate("label", OBJ_TEXT, 0, TimeCurrent(), value);
ObjectSetText("label",label, 8, "Arial", text_colour);
ObjectMove("label", 0, Time[0], value);

Is there any way to modify it to move the text to the right of the current bar and keep it there?

Thanks for any help.

 
Add something to the Time[0] value (maybe Period() * 2) and repeat the ObjectMove for each new bar
 

I've changed it to :

ObjectCreate("label", OBJ_TEXT, 0, TimeCurrent(), value);
ObjectSetText("label",label, 8, "Arial", text_colour);
ObjectMove("label", 0, Time[0]+(Period()*2), value);

but it hasn't made any difference. Any other ideas?

Cheers

 

try this...

ObjectCreate("label", OBJ_TEXT, 0, Time[0]+1000, value);

the text will shift to the right..but for each time frame can be different.

try to change 1000, 2000 or what ever it fit...

 
Paul_B:

I've changed it to :

but it hasn't made any difference. Any other ideas?

Cheers

Sorry, should have been Period() * 2 * 60, Period is in minutes, time is in seconds
 

Excellent, that sorted it perfect, thanks.

ObjectMove("label", 0, Time[0]+(Period()*120), value);