'Positioning text in a corner or other fixed location with TradingView Pine Script

I have a some text I would like to place in a corner, perhaps top-right or bottom-right but I can't find a way to position the text in such a position in Pine.

I looked for a variable that would give you a visible range for the Y axis and couldn't find anything. For the X axis tagging it to the final candle is good enough but if I could know the visible X range then I could also consider the top/bottom left corners.

Does anyone know how to fix some text in a location on the screen?

What I would also like to do is be able to make a button and populate the limit order with values I calculate but I think that's outside Pine's ability right now so just positioning some text nicely will do.



Solution 1:[1]

Hey Use The Anchored Text Option

Solution 2:[2]

Since this was asked TV has added a table feature which easily allows you to added text in corners and more.

Solution 3:[3]

var table text = table.new(position.bottom_right, 1, 1)
if barstate.islast
    table.cell(text, 0, 0, 'any text here', text_size=size.normal, text_color=color.orange)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rfella
Solution 2 Reg
Solution 3 Reg