获得 X 位置蜡烛的高点

Get The High Of X Position Candle

我正在尝试根据某些条件获取 x 位置蜡烛的高点。下面是我的代码。但是我收到错误消息“无法使用可变变量作为安全函数的参数”。有什么办法可以实现吗?

i = 0
if(condition1)
    i := 7
else if(condition2)
    i := 8
else if(condition2)
    i := 9
x = security(syminfo.tickerid,'60',high[i])
plot(x)

你只需要使用non-mutable变量,例如:

i = condition1 ? 7 : condition2 ? 8 : condition3 ? 9 : 0
h = high[i]
x = security(syminfo.tickerid,'60',high[i])
plot(x)