The rolling window is set to be the TradeBar type in the definition "self.window = RollingWindow[TradeBar](2)". You should add the TradeBar to self.window. While the type of "data["SPY"].Close" is Decimal. You should use "self.window.Add(data["SPY"])". To make sure the slice data contains the key "SPY", please add the check
if data.Bars.ContainsKey("SPY"):
self.window.Add(data["SPY"])
Another issue is the brokerage model. FXCM brokerage is used for Forex trading. For equity, please use the InteractiveBrokersBrokerage model.
self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage)
To attach the backtest, you'll find the button "Attach Backtest" when you edit the comment. You can choose the project and the backtest to add in the comment.
