RC2_IND_SERIES_CAPACITY
Series
<name>capacity references an unknown Param<capacity>.
What it means
Series(lookback) is well-formed — the capacity is a bare name, which is exactly the shape the language wants. The problem is that no Param called lookback is declared in this class.
The check is separate from RC2_IND_SERIES because the failure is different in kind: the syntax is right, the binding is missing. And the binding is what matters — the capacity is resolved to the Param’s live value, so a name that resolves to nothing would leave the buffer, and the indicator’s warmup, with no size at all.
Why it happens
A rename that only landed on one side, or a buffer copied in from another indicator that had a differently-named Param:
class MySMA(Indicator): position = ON_CHART period = Param(20, min=2, max=200) buffer = Series(lookback) # ❌ the Param is called 'period'
def compute(self, close): self.buffer.add(close) return sum(self.buffer) / len(self.buffer)Note what it is not: a plain state field is no substitute. lookback = 20 in the class body declares persistent state, not a Param, and a Series sized from it raises this same error.
How to fix it
Use the Param’s name — or declare the Param the buffer was written for.
class MySMA(Indicator): position = ON_CHART lookback = Param(20, min=2, max=200) buffer = Series(lookback)
def compute(self, close): self.buffer.add(close) return sum(self.buffer) / len(self.buffer)Several buffers may share one Param, and each may carry its own offset:
class Spread(Indicator): position = OFF_CHART period = Param(20, min=2, max=200) highs = Series(period) lows = Series(period + 1)
def compute(self, high, low): self.highs.add(high) self.lows.add(low) return sum(self.highs) / len(self.highs) - sum(self.lows) / len(self.lows)Related
- Custom Indicators
Param()RC2_IND_SERIES— the capacity is the wrong shape (a literal, or the wrong argument count).RC2_IND_PARAM— theParamexists but its declaration is rejected, so nothing binds to it.