Lipi Reference
Lipi

Functions

float()

Converts a value to a float. It accepts an int as well as a float, so it is the conversion to use when a calculation must not round.

Syntax · 1 of 4

                float(const float value) → const float
              

Arguments

value required const float The value to convert to the specified type, usually na.

Return Type

const float

Syntax · 2 of 4

                float(input float value) → input float
              

Arguments

value required input float The value to convert to the specified type, usually na.

Return Type

input float

Syntax · 3 of 4

                float(simple float value) → simple float
              

Arguments

value required simple float The value to convert to the specified type, usually na.

Return Type

simple float

Syntax · 4 of 4

                float(series float value) → series float
              

Arguments

value required series float The value to convert to the specified type, usually na.

Return Type

series float

Example


          //@lipi=2
indicator("float() Example", overlay=false)
// Dividing as floats keeps the fractional part
ratio = float(bar_index) / 7
plot(ratio, title="Bar Index / 7", color=color.blue)