Skip to content
Algo Trade Analytics Docs

:= - Pine Script Operator

:=

Reassignment operator. It is used to assign a new value to a previously declared variable.

<var_name> := <new_value>
//@version=6indicator("My script")myVar = 10if close > open    // Modifies the existing global scope `myVar` variable by changing its value from 10 to 20.    myVar := 20    // Creates a new `myVar` variable local to the `if` condition and unreachable from the global scope.    // Does not affect the `myVar` declared in global scope.    myVar = 30plot(myVar)