CS2102
hint The length changes from bar to bar, so name keeps max_bars_back (n) values.
#What it means
This is a hint, not an error. The length you passed changes from bar to bar. The function supports that, but it has to keep a window as long as max_bars_back (the number in the message) because it cannot know the longest length in advance.
#Typical cause
- A length computed per bar passed to one of the functions that accept it, such as
ta.sma,ta.ema,ta.highestorta.lowest.
#How to fix it
Nothing is required. If the length is really fixed, pass a constant or an input to drop the hint. If you know the longest length, setting max_bars_back in indicator() close to it saves memory. See Series and qualifiers.
#Example
//@chartscript 1
indicator("Adaptive average", { overlay: true })
const len = close > open ? 10 : 20
plot(ta.sma(close, len))Fixed
//@chartscript 1
indicator("Adaptive average", { overlay: true })
const len = input.int(20, "Length", { minval: 1 })
plot(ta.sma(close, len))