Skip to content
Algo Trade Analytics Docs

=> - Pine Script Operator

=>

The ’=>’ operator is used in user-defined function declarations and in switch statements.

<identifier>([<parameter_name>[=<default_value>]], ...) =>
<local_block>
<function_result>
  • You can learn more about user-defined functions in the User Manual’s pages on Declaring functions and Libraries.
//@version=6indicator("=>")// single-line functionf1(x, y) => x + y// multi-line functionf2(x, y) =>    sum = x + y    sumChange = ta.change(sum, 10)    // Function automatically returns the last expression used in itplot(f1(30, 8) + f2(1, 3))