Keywords
def
Opens a function declaration. It is interchangeable with `func`, and both are optional — a declaration may begin with either or with neither. All three spellings declare the same thing, so which you use is a house-style decision.
Syntax
def <function_name>(<data_type> <param_name> [= <default_value>], ...) {
<function_body>
}
func <function_name>(<data_type> <param_name> [= <default_value>], ...) => <expression>
Example
indicator("def Function Example", overlay=true)
def square(float x) {
return x * x
}
plot(square(close), title="Squared Close", color=color.blue)