str.tostring

Renders a value as a string. One overload takes a number and one takes a bool. There is no format argument: the call takes the value and nothing else.

str.tostring(series bool source) → series string
str.tostring(series float source) → series string
str.tostring(simple bool source) → simple string
str.tostring(simple float source) → simple string
ParameterTypeRequiredDescription
sourceseries boolyesthe value to render: an int or a float in the numeric overload, a bool in the other

Returns series string or simple string — The value as text. Where the value is na this returns the two characters NA rather than going absent - the one place in this namespace where na does not propagate.

indicator("The close as text")
alert(str.tostring(close))
plot(close)

See also str.contains · str.endswith · str.format_time

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade