cannot use a mutable variable as an argument of the security function

For some reason, destructured assignments aren’t treated the same way when a user-defined function returns them vs when security() does. Encapsulating your security() call in a function will work:

f_sec() => security(syminfo.tickerid, "D", [high,low,close], lookahead = barmerge.lookahead_on)
[h, l, c] = f_sec()
h := h * 3

Note that you are using future data on historical bars when using lookahead and not offsetting the series by 1, as you are doing in there.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top