Currently, this is a common / advisable way to perform universe selection using indicator signals. You manually seed a SymbolData class with history data, and check for indicator signals in your fine selection function.

In detail:

  1. Coarse selection function
    • Make initial selection with fundamental data
  2. Fine selection function
    • Call history() to get data
    • For each coarse symbol, create a SymbolData instance (contains indicators) 
    • Seed SymbolData with historical data
    • Check for indicator signal
    • If indicator fired, add to universe  
  3. My Trading Function
    • Process stocks that were added to my universe


This is good because we don't subscribe to securities data for all stocks; only ones that fire the signal.  However, I don't like that i have to call history() all the time, since i've heard that it is not performant. I'd like to avoid calling history at all.

Would it be advisable to do this instead: use *only* Coarse selection, then AddEquity, check for signal, then call RemoveSecurity if no signal. 

In detail:

  1. Coarse selection function
    • Make initial selection with fundamental data
  2. My Custom selection Function
    • For each coarse symbol, create a SymbolData instance (contains indicators) 
    • Use AddEquity to subscribe to data in EVERY SymbolData
    • Once we have enough warmup data, check indicator for signal
    • If indicator fired signal, add to my local dictionary 
    • If indicator did NOT fire signal, call RemoveSecurity()
  3. My Trading Function
    • Process stocks that were added to my local dictionary 
       

Would this be a good idea? or would this run slower?