Hi all,

I am new to both quantconnect and as a developer. I was trying to create a simple 5 ema and 13 ema crossover strategy on ES Futures and I got the following error:

“[ERROR] FATAL UNHANDLED EXCEPTION:Engine.Run(): During the algorithm initialization, the following exception has occurred: Please register to receive data for symbol 'ES 0' using the AddSecurity() function. in Indicators.cs:line 2090 Please register to receive data for symbol 'ES 0' using the AddSecurity() function.,ApiConnection.TryRequest(backtest/status/update): Error: The operation has timed out.”

Can someone help me understand what I need to change to get this code to run properly? When I try to run the same type of strategy on SPY, It works accurately. I think there is an issue with contract selection but I am not sure how to troubleshoot the problem.

The communities wisdom would be greatly appreciated! 

from AlgorithmImports import *
import QuantConnect


class test(QCAlgorithm):


    def Initialize(self):
        self.SetStartDate(2022, 12, 1)  # Set Start Date
        self.SetEndDate(2022, 12, 23) # End Date
        self.SetCash(100000)  # Set Strategy Cash

        self.emini = self.AddFuture(Futures.Indices.SP500EMini)
        self.emini.SetFilter(0, 90)
       
        self.fast = self.EMA(Futures.Indices.SP500EMini, 5)
        self.slow = self.EMA(Futures.Indices.SP500EMini, 13)


    def OnData(self, data):


        if self.fast.Current.Value > self.slow.Current.Value:
            self.MarketOrder(Futures.Indices.SP500EMini, 1)
        elif self.fast.Current.Value < self.slow.Current.Value:
            self.MarketOrder(Futures.Indices.SP500EMini, -1)
     

 

Author