Functions
bool()
Converts a value to a bool. Of the five conversions this one is the widest: it takes an int, a float or a bool.
Syntax · 1 of 4
bool(const bool value) → const bool
Arguments
value required const bool The value to convert to the specified type, usually na. Return Type
const bool Syntax · 2 of 4
bool(input bool value) → input bool
Arguments
value required input bool The value to convert to the specified type, usually na. Return Type
input bool Syntax · 3 of 4
bool(simple bool value) → simple bool
Arguments
value required simple bool The value to convert to the specified type, usually na. Return Type
simple bool Syntax · 4 of 4
bool(series bool value) → series bool
Arguments
value required series bool The value to convert to the specified type, usually na. Return Type
series bool Example
//@lipi=2
indicator("bool() Example", overlay=true)
// A typed na: the variable is known to be bool before it has a value
bool signal = bool(na)
signal := close > open
bgcolor(signal ? color.new(color.green, 0.2) : na)