I’ve been working through the Futures Boot Camp on QuantConnect, and I’m currently stuck on Lesson #4 (Margin Call Warning).

Even though my code is identical to the official solution, the platform keeps showing the same error:

“Looks like you didn’t use SetHoldings() correctly.”

Here’s the relevant part of my code:

 

if not self.Portfolio.Invested:    self.SetHoldings(self.liquid_contract.Symbol, 1)

Everything else (dates, filters, settings) matches the provided solution.
However, the submission still fails — even the “official answer” script gives the same error.