Hey all,

I am creating a new algorithm and I was wondering if there were any known caveats to this approach:

1) Retrieving X amount of stocks from a coarse selection filter
2) Creating indicators for each of X stocks and storing them into a dictionary
3) Wait until indicators are ready
3) Sort the stocks in the dictionary based on the indicators value 
4) ???

I am current having issues with step #3 where I feel like the backtest is looping infinitely while I am checking if the indicator is ready. If it is not ready, all indicator values come out as 0.

Any help or suggestions would be awesome! Thanks!

for symbol in selectedStocks: ### Create dictionary of every symbol with standard deviation indicators decodedSymbol = self.Symbol(symbol).Value stdDict[decodedSymbol] = self.STD(symbol, 20, Resolution.Daily) self.SetWarmUp(20, Resolution.Daily) ### Create another dictionary of every symbol with indicator values stdValDict = {} for key, value in stdDict.items(): while not value.IsReady: pass stdValDict[key] = value.Current.Value

 

Author