Returns true when every item in a bool array is true.
The check stops at the first false item. An empty array counts as true, because nothing contradicts the claim.
Collect one condition per bar, per timeframe or per rule in a bool array, then test them all at once.
Syntax
array.every(id: array<bool>) -> series bool
array.every() -> series boolArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | array<bool> | required | The bool array to test. The call is true only when every item is true. |
Returns
series bool: true when no item is false.
Example
//@version=6
indicator("array.every: three up bars", overlay = true)
var ups = array.new_bool()
array.push(ups, close > open)
if array.size(ups) > 3
array.shift(ups)
all3 = array.size(ups) == 3 and array.every(ups)
plotshape(all3, "Three up", shape.triangleup, location.belowbar, color.green)See also
Runs on Sidechair