在摆动低点被打破后寻找最高开盘价

Finding highest Open after swing Low is broken

以上代码失败并显示错误消息。 任何帮助都会有帮助

//@version=4
study("count", overlay = true)
swh = pivothigh(high,2,1)
swl = pivotlow(low,2,1)
Bcount = barssince(swh)
// plot(Bcount)
highestOpen = valuewhen(crossunder(low,swl), highest(open,Bcount+1),0)
plot(highestOpen)

问题是一开始柱线 Bcount = barssince(swh) 是 0。

//@version=4
study("count", overlay = true, max_bars_back = 100)
swh = pivothigh(high,2,1)
swl = pivotlow(low,2,1)
Bcount = nz(barssince(swh))
// plot(Bcount)
highestOpen = valuewhen(crossunder(low,swl), highest(open,Bcount+1),0)
plot(highestOpen)