'barstate.islast invalidades series[1]
Original Question
Apparently, when using barstate.islast the values before zero in a series are not returned.
Is this the expected behavior? Or is it a problem?
//@version=5
indicator("barstate.islast invalidades series[1]", max_bars_back=5000)
index = bar_index
countNonNa(indices) =>
count = 0
for i = 0 to 4999 by 1
index = indices[i]
if not(na(index))
count += 1
count
count00 = countNonNa(index)
plot(count00, "count00", color = color.blue) // ok
count01 = barstate.isconfirmed ? countNonNa(index) : 0
plot(count01, "count01", color = color.black) // ok
count02 = barstate.islast ? countNonNa(index) : 0
plot(count02, "count02", color = color.red) // error expected 5000 in the last bar, but gets 1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

