I am trying to get future selection to work. I want to select the nearest expiry that is at least 7 days away, for multiple futures. For example:

// In Initialize futureGold = AddFuture(Futures.Metals.Gold, resolution); futureEs = AddFuture(Futures.Indices.SP500EMini, resolution); futureGold.SetFilter(TimeSpan.FromDays(7), TimeSpan.FromDays(366 / 2 + 2));

Then in OnSecuritiesChanged(SecurityChanges changes) I want to extract the underlying futures, but all of the following do not provide the underlying (either exception or null): 

  • Future.Symbol.Underlying, 
  • Future.Symbol.ID.Underlying, 
  • Future.Underlying

Author