Lipi Reference
Lipi

Functions

array.includes()

Returns true when `value` is one of the array's elements.

Syntax

                array.includes(series array id, series <type of the array's elements> value) → series bool
              

Arguments

id required series array
value required series

Return Type

series bool

Example


          //@lipi=2
indicator("array.includes Example", overlay=true)
weekend = array.from(1, 7)
// dayofweek counts Sunday as 1 and Saturday as 7
isWeekend = array.includes(weekend, dayofweek)
bgcolor(isWeekend ? color.new(color.gray, 0.3) : na)