CS5202
error name[...] reached offset bars back; raise max_bars_back to suggest in indicator().
#What it means
The script looked further back in a series than it keeps. When an offset changes from bar to bar, a series keeps max_bars_back bars (500 unless you set it). The message gives the offset that was reached and a setting that would be enough.
#Typical cause
- A changing offset that grows beyond the window, for example "bars since an event".
#How to fix it
Raise max_bars_back in indicator() to the suggested value (at most 10,000), or limit the offset. See Limits.
#Example
//@chartscript 1
indicator("Far back", { max_bars_back: 100 })
const price: float = close
const back = bar_index > 200 ? 200 : 0
plot(price[back])Fixed
//@chartscript 1
indicator("Far back", { max_bars_back: 250 })
const price: float = close
const back = bar_index > 200 ? 200 : 0
plot(price[back])