Check the returned value of ChartXYToTimePrice().
Returns true if successful, otherwise false. To get information about the error, call the GetLastError() function.
Works fine for me:
I don't really understand what you are trying to achieve.
Some objects are set by time / price e.g. OBJ_RECTANGLE and OBJ_TEXT
Some objects are set by x / y e.g. OBJ_RECTANGLE_LABEL and OBJ_LABEL
You will need to pick the object type that suits your needs.
Perhaps a screenshot will help us to understand?