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

RC2_ASSIGN_RHS

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

Assignment has no right-hand side.

What it means

An assignment reached the transpiler with a target but no value to store. Every assignment in RaamCode is a write of one expression into one slot — a local, a scalar state slot, or a collection element — so a missing right-hand side leaves nothing to write, and there is no “declare without initializing” form to fall back on.

Why it happens

You started an assignment and left the value off — usually mid-edit, or after deleting the expression and leaving the = behind:

def execute(self):
self.up_count = # ❌ nothing to store
if self.trade.close > self.trade.open:
self.up_count = self.up_count + 1

In practice the parser usually reaches this line first and reports RC2_PARSE — self.up_count = is not valid Python either. RC2_ASSIGN_RHS is the transpiler’s own guard for the same shape, and it is what you see when the statement parsed but carries no value.

There is also no bare declaration form. self.up_count on a line of its own does not create the slot (that is RC2_EXEC_STMT — a statement that does nothing), and neither does a type annotation without a value. State is created by assigning to it.

How to fix it

Give the assignment a value — for a counter, the seed value is enough, and the first assignment is what declares the slot.

class Good(Strategy):
trade = Symbol()
sizing = FixedCapital()
def execute(self):
self.up_count = 0 # ✅ a value, so a slot exists
if self.trade.close > self.trade.open:
self.up_count = self.up_count + 1
if self.up_count > 0 and self.trade.is_flat:
self.buy(self.trade)

A class-body declaration does the same job and is the only way to give a slot a non-zero starting value:

class Seeded(Strategy):
trade = Symbol()
sizing = FixedCapital()
ath = 0.0 # ✅ declared with its initial value
def execute(self):
if self.trade.close > self.ath:
self.ath = self.trade.close
if self.trade.is_flat and self.trade.close < self.ath * 0.95:
self.buy(self.trade)
  • Persistent State — first assignment declares the slot; the class body seeds it.
  • RC2_ASSIGN_LHS — the mirror image: a value with no single slot to write it to.
  • RC2_EXEC_STMT — a statement that stores nothing at all.