:= - Pine Script Operator
:=
Overview
Section titled “Overview”Reassignment operator. It is used to assign a new value to a previously declared variable.
Syntax
Section titled “Syntax”<var_name> := <new_value>Example
Section titled “Example”//@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)