I have made a custom indicator and I need to place some text next to a line. I would like to have the text following the line and in some cases above the line but I cannot find a way to prevent the text being centred and below the coordinates I specify.
I tried to calculate the coordinate offsets manually, but when I change the chart window size or even timeframes then it gets messed up.
Could some explain to me how to correctly control the OBJ_TEXT placement relative to a given object on the chart?
As you say, the point specified for OBJ_TEXT is in the centre at the top of the text - you see it when you select the text. As far as I know if you want to locate the text relative to another point, you (or your code) must do the calcs and, yes it is awkward to deal with changes of axis scales. I struggled with this for some time and eventually accepted that it was easier just to accept centred below the line.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.