Hi,
The attached backtest builds a dollar-volume screen using pipeline. The custom factor tracks the average daily dollar volume traded over the trailing window. The pipeline uses the AvgDailyDollarVolume factor to screen the algorithm's universe to stocks trading more than $100M on average over the past 100 days. The algo maintains a portfolio of: long the 100 most traded stocks, and short the 100 least traded stocks.
This factor is similar to the calculations done for DollarVolumeUniverse. However, pipeline is much faster, calculates dollar volume for all stocks every day (DVU is quarterly), and allows for filtering by rank, percentile, or value.
Dollar volume is a good first pass filter to avoid illiquid assets. We'll undoubtedly add a builtin Factor for dollar volume, but in the meantime this should work pretty well in lieu of calls to set_universe.
happy coding,
fawce