Bollinger Band "Number overflow'' error AND questions on Coarse Universe Selection w Daily Resolution


For my first QC project I want to use AddUniverse Coarse Selection and some indicators (sma & Bollinger Bands) on the selected securities.  Daily Resolution only.

1) To do this: in OnData(), foreach security passed in, I construct a new Indicator object for it, and update with historical data.  Is this approach correct?  I can't construct the Indicator objects in Initialize() as we don't know which securities will be selected.

2) The SMA seems to work, but I get a "runtime error: Number Overflow" for the Bollinger Bands.

3) Other questions for the Coarse Selection:

a) I am selecting the top 5 securities by Dollar Volume, but OnData() is called for 4-7 securities daily.

   Why are 4-7 securities returned when 5 specified?  MinimumTimeInUniverse is set to 1 day.  Do several securities have equal DollarVolume values?  I want to make sure that I'm specifying this correctly - with top N securities specified, then N are returned (..or approximately N is OK). 

b) The Coarse Selection returns a lot of ETF, I only want equities.  Can I remove/ignore the ETFs, either in the Coarse Selection or in OnData()?

   I may also want to ignore ADRs, B class shares and LCs/LLPs.  Can I get the full security name (e.g.: 'BERKSHIRE HATHAWAY CLASS B', 'SEADRILL PARTNERS LLC') from within OnData() ?





Update Backtest

Update Backtest


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed