Skip to content
Open RaamTrade

RC2_PARAM_RESERVED

Param '<name>' shadows the strategy-level property self.<name>. Rename the Param.

What it means

A handful of names on self belong to the strategy itself, and are readable in execute() on every bar:

Property What it reads
self.capital Current account equity.
self.initial_capital Equity the run started with.
self.bar_count Bars seen so far.
self.ready Whether every indicator has finished warming up.

A Param with one of those names would make self.capital mean two different things in the same method — a tunable input in the class body, live account state in the engine. Rather than picking a winner, the transpiler refuses the declaration: the failure mode it prevents is a strategy that sizes off a stale constant while reading like it sizes off equity.

Why it happens

The name is simply the obvious one for what the Param does:

class ShadowedCapital(Strategy):
capital = Param(10000, min=1000, max=100000)
trade = Symbol()
sizing = FixedCapital()
def execute(self):
if self.trade.is_flat:
self.buy(self.trade)

How to fix it

Rename the Param. The reserved property keeps working, and the two now read as the different things they are.

class RenamedParam(Strategy):
risk_capital = Param(10000, min=1000, max=100000)
trade = Symbol()
sizing = FixedCapital()
def execute(self):
if self.capital > self.risk_capital and self.trade.is_flat:
self.buy(self.trade)

The same reserved list applies to persistent state (self.capital = … is RC2_STATE_RESERVED) — one set of names, protected everywhere they could be written.