== - Pine Script Operator
Overview
Section titled “Overview”The equality operator compares two compatible values. It returns true when they
are equal and false otherwise. The result can be a series bool when either
operand changes from bar to bar.
Syntax
Section titled “Syntax”leftExpression == rightExpressionOperand and result types
Section titled “Operand and result types”== supports compatible fundamental values such as numbers, booleans, colors, and
strings. It can also compare compatible reference IDs. The result is boolean.
Example
Section titled “Example”//@version=6indicator("Equality example", overlay = true)
bool unchangedClose = close == close[1]plotshape(unchangedClose, title = "Unchanged close", style = shape.circle)Remarks
Section titled “Remarks”- Equality has lower precedence than arithmetic and relational operators, and
higher precedence than
and,or, and?:. - Do not test for an unavailable value with
value == na. Usena(value)instead. - Floating-point calculations can produce values that are visually similar but not equal. Compare a tolerance when exact equality is not the intended rule.