S011
setup value reads a later declaration
Severity Error
Setup values are evaluated top to bottom in source order. This expression uses a binding that is declared further down the file, so its value does not exist yet when the expression runs.
Move the referenced declaration above its first use.
Failing example
script "Tick band"
data chart = subscribe(data.ohlcv)
setup band = width * context.tickSize
input width = input.int(10, title: "Band width (ticks)", min: 1)
plot upper = plot.line(title: "Close + band")
on chart.close {
upper.plot(chart.close + band)
}Fixed example
script "Tick band"
data chart = subscribe(data.ohlcv)
input width = input.int(10, title: "Band width (ticks)", min: 1)
setup band = float(width) * context.tickSize
plot upper = plot.line(title: "Close + band")
on chart.close {
upper.plot(chart.close + band)
}