|
Dave W.
2013-11-20 23:26:05
|
|
I'm trying to build an intraday trading system where, each day, the system chooses the top 10 stocks from a watchlist of the Nasdaq 100 constituents and only trades those 10 stocks. The following day, the system would re-rank / re-select the top 10 stocks and only trade those. The rank is based on stocks with the highest normalized intraday range (not ATR).
I thought the best way to do this would be to create a dynamic watchlist and assign that watchlist to my intraday trading system. I'm not sure if that's the best way to do it, though.
More immediately, though, I can't figure out how to get my dynamic watch list to rank the stocks. Here is my watchlist code. Based on removing the filter and examining the column values, the Comp functions both return NaN. I've read through a number of articles on the QuantShare site, and I think my Comp functions are properly formed. Are they correct? Any help would be appreciated.
// Choose the top X stocks from the Nasdaq 100 where the daily range
// is the highest over the last Y bars. The filter only considers
// stocks with 1M+ volume over last month, and a minimum price of Z.
TopRankLimit = 10;
SmaLookback = 10;
MinPrice = 10;
PriceVolumeFilter = close > MinPrice && sma(volume,22) > 1000000;
DailyRange = 100 * sma( (high - low) / close, SmaLookback );
AvgDailyRange = comp(DailyRange, "avg", 1, PriceVolumeFilter);
DailyRangeRank = comp(DailyRange, "rank", 1, PriceVolumeFilter);
filter = DailyRangeRank <= TopRankLimit;
AddColumn("DailyRange", DailyRange) ;
AddColumn("PriceVolumeFilter", PriceVolumeFilter ) ;
AddColumn("DailyRangeRank", DailyRangeRank ) ;
AddColumn("AvgDailyRange", AvgDailyRange ) ;
|
|