NEWBIE HELP: OBJ_TEXT positioning

 

I am trying to position a set of OBJ_TEXT objects in the centre of the chart space. i.e the Y postion set absolutely and not based on any reference to price.


ObjectCreate(MyTEXT[i], OBJ_TEXT,0,Time[i],Open[i];


is what i have been playing with, but i dont want the text to show at the open, but in the absolute middle of the chart.


I cant seem to use the OBJ_LABEL datatype because i want to make of use the Time[i] data for setting my X coordinate.



can anyone help? i have tried a million things at this stage.


Thanks.

 

As an attempt to help you:

1. Find the number of bars in the window - use

WindowBarsPerChart( )

2.The half of this number is your X coordinate.

3. Find max and min price in the window - use iHighest() and iLowest() functions

4. (max- min)/2 is your Y coordinate.

 

OK. Thanks for that. I see how that could work.


Would you say i should stick with trying to work with the OBJ_TEXT object, or shall i switch to OBJ_LABEL?

 
Up to you. If you plan to use OBJ_LABEL, you have to know it doesn't use coordinates, only pixels from top left corner.