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
xseriesThe series or value to retrieve
defaultseriesOptional default value

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

Example​

uptrend = conditional (close > open)

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