Hi there,

One thing that is not clear to me is how to access indicators with multiple continuous futures contracts.

I understand how the SMA indicator is being accessed when accessing the history of one continuous futures contract like in this example:

# region imports
from AlgorithmImports import *
# endregion

class USFuturesSecurityMasterDataClassicAlgorithm (QCAlgorithm):
    
    threshold = 0.01 # 1%
    
    def Initialize(self) -> None:
        self.SetCash(1000000)
        self.SetStartDate(2022, 1, 1)
        self.SetEndDate(2022, 6, 1)

        # Requesting data
        self.continuous_contract = self.AddFuture(Futures.Energies.CrudeOilWTI,
                                                  dataNormalizationMode = DataNormalizationMode.BackwardsRatio,
                                                  dataMappingMode = DataMappingMode.OpenInterest,
                                                  contractDepthOffset = 0)
        self.symbol = self.continuous_contract.Symbol
                      
        # Historical data
        history = self.History(self.symbol, 500, Resolution.Minute)
        self.Debug(f"We got {len(history)} items from our history request")

        self.sma = self.SMA(self.symbol, 10, Resolution.Daily)
        if not history.empty:
            for time, row in history.droplevel(0).loc[self.symbol].iterrows():
                self.sma.Update(IndicatorDataPoint(time, row.close))
        self.Log(history)

    def OnData(self, slice: Slice) -> None:
        # Accessing data
        for changed_event in slice.SymbolChangedEvents.Values:
            if changed_event.Symbol == self.symbol:
                self.Log(f"SymbolChanged event at {self.Time}: {changed_event}")
                
        mapped_symbol = self.continuous_contract.Mapped

        if not (slice.Bars.ContainsKey(self.symbol) and self.sma.IsReady and mapped_symbol):
            return
        
        if slice.Bars[self.symbol].Price > self.sma.Current.Value * (1+self.threshold) and not self.Portfolio[mapped_symbol].IsLong:
            self.MarketOrder(mapped_symbol, 1)
        elif slice.Bars[self.symbol].Price < self.sma.Current.Value * (1-self.threshold) and not self.Portfolio[mapped_symbol].IsShort:
            self.MarketOrder(mapped_symbol, -1)

But what if I want to access the SMA indicator for an array of continuous futures whose history is accessed by something like this:

# Requesting data
self.CL = self.AddFuture(Futures.Energies.CrudeOilWTI,
          dataNormalizationMode = DataNormalizationMode.BackwardsRatio,
          dataMappingMode = DataMappingMode.OpenInterest,
          contractDepthOffset = 0)
self.ES = self.AddFuture(Futures.Indices.SP500EMini,
          dataNormalizationMode = DataNormalizationMode.BackwardsRatio,
          dataMappingMode = DataMappingMode.OpenInterest,
          contractDepthOffset = 0)
          
self.symbols = [
                 self.CL.Symbol,
                 self.ES.Symbol
               ]

# Get historical data
data = self.History(self.symbols, period, Resolution.Daily)

How would I iterate using:

for symbol in self.symbols:

to generate SMA for each symbol so I could determine whether or not to buy/sell that symbol based on comparing price to the SMA?

Thanks in advance,

David