RC2_MULTI_TRADE
תוכן זה אינו זמין עדיין בשפה שלך.
Only one Symbol may have
trade=True(multi-symbol trading is not supported in v2).
What it means
A strategy has exactly one trading slot — the one slot orders can target, the one that carries a position, and the one the position helpers (is_flat, position, …) read. Every other Symbol() is a data feed. Marking two slots trade=True asks for two positions in one strategy, which the engine has no model for: there is a single position book per strategy, and no way to say which slot a self.buy(...) should have moved.
Why it happens
Usually a hedge or a pairs idea — two instruments the author intends to trade against each other:
class PairsTrade(Strategy): trade = Symbol(trade=True) hedge = Symbol(ticker="SPY", trade=True) sizing = FixedCapital()
def execute(self): if self.trade.is_flat: self.buy(self.trade)How to fix it
Pick the one instrument the strategy takes a position in, and leave the rest as data feeds.
class FeedFiltered(Strategy): trade = Symbol(trade=True) spy = Symbol(ticker="SPY") sizing = FixedCapital()
def execute(self): spy_sma = SMA(50, on=self.spy) if self.spy.close > spy_sma.value and self.trade.is_flat: self.buy(self.trade)If you genuinely need two positions, that is two strategies. Deploy them side by side against the same account — each one owns its own slot, its own sizing, and its own exits.
Related
Symbol()- Position Helpers
RC2_NO_TRADE— the mirror image: two or more Symbols and none markedtrade=True.RC2_SIG_DATAFEED— what you get if you then aim an order at the data feed.