Logical OR: a or b is true when either is true, and in v6 b is not evaluated when a is already true.
or combines two bool values and gives true when at least one is true. It has the lowest precedence of the logical operators, so a and b or c is (a and b) or c.
In v6 it is lazy: when the left side is true, the right side is skipped. Use it to put a cheap test first and an expensive one second.
Syntax
expr1 or expr2Remarks
- Ta functions on the right side may not run on every bar under lazy evaluation; keep them in their own variables.
- On Sidechair: or short-circuits in v6 scripts and evaluates both sides in v5 scripts.
Example
//@version=6
indicator("Or", overlay = true)
rsi = ta.rsi(close, 14)
extreme = rsi > 70 or rsi < 30
bgcolor(extreme ? color.new(color.orange, 85) : na)
plot(close, "Close", color.gray)See also
Runs on Sidechair