Hi, I am fairly new to QuantConnect. 

I have been trying to read the documentation and look at the examples and discussions - a lot of helpful material here, but I still have some questions (and an error message) I hope the community can help me with. Any help will be greatly appreciated :-)

Basic premise of my questions: (see attached code)

  • I want to trade Futures (ES pr now)
  • I want to create and use a custom indicator
    • The indicator is a daily indicator that uses intraday data to calculate the value
    • The exact implementation can be many things; for instance number of 5 minute bars up-close for the day, market profile value area etc etc.
    • For "yesterdays" indicator value, all the intraday data for yesterday is used. 
    • For "todays" indicator value, intraday data up to current trade time is used.
Questions:
  • The way the current future-contract is retrieved (in OnData) is a little verbose - is it possible to do this in the Initialize (maybe by specifying a continuous contract)?
  • Is there a better way of filling an indicator with a whole days worth of intraday data (I was not able to use the History-method with a consolidator)?
    • Right now this is done very manually
  • ERROR MESSAGE: If I uncomment line 46 ( UpdateIndicators(halfHourBar) ) - I get error when running backtest... does anybody know what causes this (I am using a Future, but it is asking me to add a Security).  The only thing done there is to generate the indicators that I on purpose do not want to be auto-filled with data (subscription).
    • Runtime Error: Please register to receive data for symbol ' ' using the AddSecurity() function.
    • System.Exception: Please register to receive data for symbol ' ' using the AddSecurity() function.
      at QuantConnect.Algorithm.QCAlgorithm.GetSubscription (QuantConnect.Symbol symbol, System.Nullable`1[T] tickType) [0x00098] in :0 
      at QuantConnect.Algorithm.QCAlgorithm.GetSubscription (QuantConnect.Symbol symbol) [0x00001] in :0 
      at QuantConnect.Algorithm.QCAlgorithm.CreateIndicatorName (QuantConnect.Symbol symbol, System.String type, System.Nullable`1[T] resolution) [0x00010] in :0 
      at QuantConnect.Algorithm.CSharp.FuturesWithCustomIndicator.CustomIndicator (System.String symbol, System.Int32 length, System.Int32 dayOfYear, System.Nullable`1[T] resolution) [0x0001e] in <4728ce776caa419a89c752e14aaca01c>:0 
      at QuantConnect.Algorithm.CSharp.FuturesWithCustomIndicator.UpdateIndicators (QuantConnect.Data.Market.TradeBar halfHourBar) [0x0001e] in 

Author