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

RC2_IND_ON_MULTIVALUE_CHAIN

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

Chaining onto a multi-value output (on=<source>.<output>) requires runtime support that lands in a follow-up phase.

What it means

This one is not a mistake in your code — it is a feature that has not shipped. on=aroon.up is the right way to say “an EMA of Aroon’s up line”, the transpiler understands exactly what you asked for, and it refuses anyway because the runtime cannot yet subscribe a chained indicator to one field of a multi-output record.

It is a hard error rather than a warning for the usual reason: silently chaining onto some other series would produce numbers that look plausible and are wrong.

Why it happens

class Bad(Strategy):
trade = Symbol()
sizing = FixedCapital()
def execute(self):
aroon = Aroon(14, on=self.trade)
smooth = EMA(5, on=aroon.up) # ❌ correct spelling, not yet supported
if smooth.value > 50 and self.trade.is_flat:
self.buy(self.trade)

How to fix it

Use the raw output and express the smoothing yourself, or restate the idea against a single-value indicator that can be chained.

class Good(Strategy):
period = Param(14, min=5, max=50)
trade = Symbol()
sizing = FixedCapital()
prev_up = 0.0
def execute(self):
aroon = Aroon(self.period, on=self.trade)
# A two-bar average of aroon.up, kept by hand.
smoothed = (aroon.up + self.prev_up) / 2
self.prev_up = aroon.up
if smoothed > 70 and self.trade.is_flat:
self.buy(self.trade)
if smoothed < 30 and self.trade.is_long:
self.sell(self.trade, self.trade.position)

Chaining onto a single-value indicator works today and needs none of this:

class Chained(Strategy):
trade = Symbol()
sizing = FixedCapital()
def execute(self):
rsi = RSI(14, on=self.trade)
smooth = EMA(5, on=rsi) # ✅ RSI is single-value
if smooth.value > 50 and self.trade.is_flat:
self.buy(self.trade)