I am new to Pinescript and confused about the following code. is_sunday is a user-defined boolean. On the third line below, the code specifies is_sunday[1]. I don't understand this. is_sunday is not a collection and not a series variable that use could use the square bracket to access by index value. If anyone can explain this use/syntax, I'd appreciate it. Many thanks.
is_sunday = dayofweek == dayofweek.sunday
if NWOG.settings.show and timeframe.isintraday
if not is_sunday[1] and is_sunday
What makes you think it is not series
? It is indeed of type series
.
dayofweek
is series int
. It will be different on each day. Therefore, dayofweek == dayofweek.sunday
will have a different result on each day and you will have history (series
) of this check.