Functions
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.
Syntax · 1 of 6
str.tostring(simple float source) → simple string
Arguments
source required simple float Return Type
simple string Syntax · 2 of 6
str.tostring(series float source) → series string
Arguments
source required series float Return Type
series string Syntax · 3 of 6
str.tostring(simple float value, simple string format, simple float mintick) → simple string
Arguments
value required simple float format simple string mintick simple float Return Type
simple string Syntax · 4 of 6
str.tostring(series float value, series string format, simple float mintick) → series string
Arguments
value required series float format series string mintick simple float Return Type
series string Syntax · 5 of 6
str.tostring(simple bool source) → simple string
Arguments
source required simple bool Return Type
simple string Syntax · 6 of 6
str.tostring(series bool source) → series string
Arguments
source required series bool Return Type
series string Example
//@lipi=2
indicator("str.tostring Example", overlay=true)
if barstate.islast {
// Round first to control the number of decimals shown
label.new(bar_index, high, text="Close: " + str.tostring(math.round(close, 2)))
}