Jared Broad, This is a follow-up to our discussion in Slack. Thanks so much for your response.

Is it possible, using history, rolling window, or something else, to select Universe based on whether today was a hammer at end of day?

One of my first attempts at this was based on the EMA Universe Selection tutorial in the Bootcamp. Here's a version of that attempt: this is giving me a bunch of Please register to receive data for symbol... errors:

class HammersUniverse(QCAlgorithm):

def Initialize(self):
self.SetStartDate(2020, 2, 20)
self.UniverseSettings.Resolution = Resolution.Daily
self.hammers = { }

def CoarseSelectionFunction(self, universe):
selected = []
universe = sorted(universe, key=lambda c: c.DollarVolume, reverse=True)

# If I only want US stocks, is this the correct route?
universe = [c for c in universe if c.Price > 10 and c.Market == 'usa'][:10]

for security in universe:
symbol = security.Symbol

if symbol not in self.hammers:
history = self.History(symbol, 1, Resolution.Daily)
self.hammers[symbol] = SelectionData(self, history, symbol)

self.hammers[symbol].update(security.Time, security.Price)

if self.hammers[symbol].is_ready():
_hammer_value = self.hammers[symbol].Current.Value
if _hammer_value == 1 or _hammer_value == -1:

return selected[:10]

def OnSecuritiesChanged(self, changes):
for security in changes.RemovedSecurities:
# self.Liquidate(security.Symbol)
self.Debug(f"Added: { security.Symbol }")

for security in changes.AddedSecurities:
# self.SetHoldings(security.Symbol, 0.10)
self.Debug(f"Removed: { security.Symbol }")

class SelectionData():

def __init__(self, algo, history, symbol):
# Could not call CandleStickPatterns directly like we do EMA in the Bootcamp, so I pass the
# Also, for Hammer, I needed the symbol we are working with.
# Is this a good way to go?
self.hammer = algo.CandlestickPatterns.Hammer(symbol, Resolution.Daily)

for bar in history.itertuples():
tradebar = TradeBar(bar.Index[1], bar.Index[0], bar.open, bar.high, bar.low, bar.close, bar.volume)

def is_ready(self):
return self.hammer.IsReady

def update(self, time, price):
self.hammer.Update(time, price)

I diverged from this based on some forum posts I'd seen, but none speak to this specific need directly, so I have been piecing things together).

In Slack, you'd mentioned that I am using the helper method, and that I need to use the actual class--the helpers are normally capitalized, but in the candle sections are lowercase. Where might I find the documentation on this? You are referring to the call to

algo.CandlestickPatterns.Hammer(symbol, Resolution.Daily)

, correct?