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

RC2_IND_ON_FIELD

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

Indicator <name> on=self.<slot>.<field> — <field> is not a valid OHLCV field.

What it means

on=self.trade.high points an indicator at one field of a symbol’s bars instead of the default close. The field list is fixed and complete: open, high, low, close, volume. That is the whole bar — a bar carries nothing else.

Derived quantities people expect to find here (typical, hlc3, median, ohlc4, hl2) are not fields; they are arithmetic. The transpiler will not invent them, because a silently-wrong input series produces a plausible-looking indicator that is measuring the wrong thing.

Why it happens

class Bad(Strategy):
trade = Symbol()
sizing = FixedCapital()
def execute(self):
sma = SMA(20, on=self.trade.typical) # ❌ not an OHLCV field
if sma.value > 0 and self.trade.is_flat:
self.buy(self.trade)

The other frequent shape is a plural or an alias — on=self.trade.highs, on=self.trade.Close. Field names are lowercase and singular.

How to fix it

Name a real field.

class Good(Strategy):
trade = Symbol()
sizing = FixedCapital()
def execute(self):
high_sma = SMA(20, on=self.trade.high)
low_sma = SMA(20, on=self.trade.low)
if high_sma.value > low_sma.value and self.trade.is_flat:
self.buy(self.trade)

If you genuinely wanted a derived series such as a typical price, build it in the strategy from the bar fields ((self.trade.high + self.trade.low + self.trade.close) / 3), or write a custom indicator whose compute(self, high, low, close) does the arithmetic — a custom indicator can take any subset of the bar fields.