Skip to content
Open RaamTrade

RC2_IND_PARAM_KIND

Indicator Param <name> is a bool/string, and an indicator’s parameter values ride the chart’s numeric wire.

What it means

An indicator’s parameters are numbers. A strategy’s are not limited that way — Param(False) and Param("trail", choices=[...]) are both fine there — because a strategy’s parameter values travel as raw typed values from end to end.

An indicator’s do not. A chart addresses an indicator by folding its values into a spec string (SMA:20, MACD:12,26,9) and stores them on the board as numbers. There is nowhere for a True or a "trail" to be kept, so the door refuses it here rather than letting it compile and fail later as a rejected board save.

Why it happens

A switch written as a bool:

class SmoothedMomentum(Indicator):
position = OFF_CHART
period = Param(14, min=2, max=200)
smoothed = Param(False)
buffer = Series(period)
def compute(self, close):
self.buffer.add(close)
if not self.is_ready:
return 0
return close - self.buffer[0]

Or a mode written as text:

class TextMode(Indicator):
position = OFF_CHART
period = Param(14, min=2, max=200)
style = Param("fast", choices=["fast", "slow"])
buffer = Series(period)
def compute(self, close):
self.buffer.add(close)
if not self.is_ready:
return 0
return close - self.buffer[0]

How to fix it

Write the switch as a numeric enum. choices= still gives the user a labelled picker rather than a number box, and the value the indicator is handed is the raw integer:

class SmoothedMomentum(Indicator):
position = OFF_CHART
period = Param(14, min=2, max=200)
smoothed = Param(0, choices={0: "off", 1: "on"})
buffer = Series(period)
def compute(self, close):
self.buffer.add(close)
if not self.is_ready:
return 0
raw = close - self.buffer[0]
if self.smoothed == 1:
return raw / 2
return raw
  • Param()
  • Custom Indicators
  • RC2_IND_PARAM — the default is missing, or is not a literal at all.
  • RC2_PARAM_ENUM_BOOL — choices=[False, True] on a strategy Param, where a plain Param(False) is the right spelling.