Overall Statistics Total Trades0Average Win0%Average Loss0%Compounding Annual Return0%Drawdown0%Expectancy0Net Profit0%Sharpe Ratio0Loss Rate0%Win Rate0%Profit-Loss Ratio0Alpha0Beta0Annual Standard Deviation0Annual Variance0Information Ratio0Tracking Error0Treynor Ratio0Total Fees\$0.00
```class DynamicCalibratedContainmentField(QCAlgorithm):

frontContract = None
futureSma = None

def Initialize(self):
self.SetStartDate(2019, 9, 3)  # Set Start Date
self.SetEndDate(2019, 9, 4)    #Set End Date
self.SetCash(50000)

futureES.SetFilter(timedelta(0), timedelta(182))

def OnData(self, data):

# If we haven't already stored the front contract, we need to find it
if self.frontContract is None:

# Get front month symbol
for chain in data.FutureChains:

# Get contracts expiring no earlier than in 90 days
contracts = list(filter(lambda x: x.Expiry > self.Time + timedelta(90), chain.Value))

# If there is any contract, store the front month contract
if len(contracts) == 0: continue

self.frontContract = sorted(contracts, key = lambda x: x.Expiry, reverse=True)[0]

self.Log(f"Front month contract found: {self.frontContract.Symbol}")

# If we haven't already created the SMA, we need to create it
if self.futureSma is None and self.frontContract is not None:

self.futureSma = self.SMA(self.frontContract.Symbol, 2, Resolution.Minute)

self.Log("SMA created")

# If our SMA is defined but isn't ready yet, we can't continue
if self.futureSma is not None and self.futureSma.IsReady:

self.Log(f"Value: {self.futureSma.Current}")```