Skip to main content

get_value

Syntax Format

get_value(x[, default])

Overview

The get_value function returns the value of x at the current bar or default value, if x does not have the current value. This function is helpful in case you need to use the series as a condition for the if statement.

Parameters

ParameterTypePurpose
xseriesInput value, taken into calculation
defaultseriesOptional default value

Returns: the same type as x. If type of x is not series – x is returned, if x is not nildefault otherwise.

Example

uptrend = conditional (close > open)

if get_value(uptrend) then
print("Going up")
end