דלגו לתוכן
פתיחת RaamTrade

RC2_IND_PERIOD

תוכן זה אינו זמין עדיין בשפה שלך.

Indicator <name> requires a period as its first argument (e.g. SMA(14, on=self.trade)).

What it means

Every indicator construction must carry at least one positional argument, and the first one is the period. The period is what the platform uses to size the indicator’s rolling buffer and to compute the strategy’s warmup floor — the number of bars that must be prefilled before execute() runs for the first time.

There is no default. A missing period would mean a buffer of unknown length and a warmup the runner cannot compute, so the transpiler refuses rather than guessing a number that would silently change your results.

Why it happens

class Bad(Strategy):
trade = Symbol()
sizing = FixedCapital()
def execute(self):
sma = SMA(on=self.trade) # ❌ on= given, period missing
if sma.value > 0 and self.trade.is_flat:
self.buy(self.trade)

Almost always this is a keyword argument that got typed where the positional was meant — on= looks like it fills the slot, but it does not.

How to fix it

Put the period first, positionally; on= comes after it.

class Good(Strategy):
period = Param(20, min=2, max=200)
trade = Symbol()
sizing = FixedCapital()
def execute(self):
sma = SMA(self.period, on=self.trade)
if sma.value > 0 and self.trade.is_flat:
self.buy(self.trade)

A literal (SMA(20, ...)) and a Param reference (SMA(self.period, ...)) are both accepted. Prefer the Param — it is what makes the length optimizable.

Indicators that take more than one number take them all positionally, period first: MACD(12, 26, 9, on=self.trade), BollingerBands(20, 2, on=self.trade).

A zero-parameter indicator still needs the positional

Volume is declared in the catalog with no parameters, but the “first argument” check runs before the per-indicator arity check — so Volume(on=self.trade) is still RC2_IND_PERIOD and needs a throwaway Volume(1, on=self.trade). That is a wart, not a rule you should read anything into.

  • Indicators
  • Warmup
  • RC2_UNKNOWN_INDICATOR — the name itself is not an indicator, so the period was never reached.
  • RC2_IND_ARG_COUNT — the period is there, but you passed more numbers than the indicator takes.