Sidechair

label.set_tooltip()

Browse the reference

Sets the pop-up text that appears when the pointer rests on a label.

Try it in the editor

A tooltip is the place for detail that would crowd the label itself: the values behind a signal, the rule that fired, or a timestamp. It is stored apart from the label text, so changing one leaves the other alone.

Pass an empty string to remove the tooltip. \n starts a new line inside it.

Syntax

Pine Script
label.set_tooltip(id: series label, tooltip: series string) -> void
label.set_tooltip(tooltip: series string) -> void

Arguments

NameTypeDefaultDescription
idseries labelrequiredThe label whose hover text changes. The visible text is not touched.
tooltipseries stringrequiredThe hover text for the label. An empty string removes it, and \n starts a new line inside the pop-up.

Returns

Nothing.

Remarks

  • On Sidechair: the tooltip is stored on the label but no hover text is drawn on the chart, so put anything the reader must see in the label text.

Example

Pine ScriptHover text listing the last three closesOpen in editor
//@version=6
indicator("label.set_tooltip: recent closes", overlay = true)
var label l = label.new(bar_index, high, "i")
label.set_xy(l, bar_index, high)
label.set_tooltip(l, "close " + str.tostring(close) + "\nprev " + str.tostring(close[1]) + "\nbefore " + str.tostring(close[2]))

See also

Runs on Sidechair