Skip to content
Open RaamTrade

RC2_IND_METHOD

Indicator classes support only the compute() method. Found <name>.

What it means

An Indicator has exactly one entry point. compute() is called once per bar and that is the entire contract — there is no __init__, no on_start, no lifecycle hook, and no private helper.

The restriction is deliberate: an indicator has to be usable from the graph engine that powers optimization and walk-forward, and that engine lowers compute() into a single per-bar expression tree. A second method would be code the graph path cannot see, so it is refused at the door rather than silently ignored.

Helper methods are available — in strategies, not indicators. See Helper Methods.

Why it happens

class MySMA(Indicator):
position = ON_CHART
period = Param(20, min=2, max=200)
buffer = Series(period)
def average(self): # ❌ only compute() is allowed
return sum(self.buffer) / len(self.buffer)
def compute(self, close):
self.buffer.add(close)
return self.average()

The same error covers def __init__(self, ...). Initial values for state belong in the class body as literals (prev = 0), not in a constructor.

How to fix it

Inline the helper. compute() may declare as many local variables as it needs, so the readability a helper was buying is usually free.

class MySMA(Indicator):
position = ON_CHART
period = Param(20, min=2, max=200)
buffer = Series(period)
def compute(self, close):
self.buffer.add(close)
average = sum(self.buffer) / len(self.buffer)
return average

If the helper was genuinely a separate measurement, make it a separate indicator and compose them — an indicator class body may declare another indicator as a child (fast = SMA(period)), and a strategy can declare as many indicators as it likes.