Pine Script warning

Viewed 21

I'm having problems understanding this. Why is the first example giving a warning but not the second?

//@version=5
indicator("Test warning", overlay = true)

float h = na
h(i) =>
    high[i]

if barstate.islast
    for i = 0 to 10
        h := h(i)

plot(close)

//@version=5
indicator("Test warning", overlay = true)

float h = na
if barstate.islast
    for i = 0 to 10
        h := high[i]

plot(close)
0 Answers
Related