Skip to content
Algo Trade Analytics Docs

== - Pine Script Operator

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.

leftExpression == rightExpression

== supports compatible fundamental values such as numbers, booleans, colors, and strings. It can also compare compatible reference IDs. The result is boolean.

//@version=6
indicator("Equality example", overlay = true)
bool unchangedClose = close == close[1]
plotshape(unchangedClose, title = "Unchanged close", style = shape.circle)
  • 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. Use na(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.