So I have created this custom class and relevant code like this - 

Search for "rsiSelectionData.update(sec.EndTime, sec.AdjustedPrice, sec.DollarVolume)".

 

While debugging, the debugger goes to this line, but nest step it goes to next line

"validBuyValues =  filter(lambda x : x.isBuyZone, self.stateData.values())"

Not sure why the debugger does not go into the custom update method?

I get the debt statements though. Any ideas? thank you

 

from Alphas.RsiAlphaModel import RsiAlphaModel from Execution.ImmediateExecutionModel import ImmediateExecutionModel from System import * from System.Collections.Generic import List from QuantConnect import * from QuantConnect.Algorithm import QCAlgorithm from QuantConnect.Data.UniverseSelection import * ''' Simple testing strategy so that find all stocks for which the RSI is more than 20 Buy. - if RSI of today is more than 25, but yesterday was less than 25 Liquidate - if RSI of open positions goes above 75 SELL - if RSI today is less than 75 but yesterday was more than 75 Liquidate - if RSI of open positions goes below 25 ''' class ResistanceVentralThrustAssembly(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 11, 20) # Set Start Date self.SetEndDate(2019, 11, 21) self.SetCash(10000) # Set Strategy Cash # Strategy is for Daily data self.UniverseSettings.Resolution = Resolution.Daily #self.AddUniverse(self.MyCoarseFilterFunction, self.FineSelectionFunction) self.AddUniverse(self.MyCoarseFilterFunction) self.SetWarmUp(timedelta(20)) self.AddAlpha(RsiAlphaModel(60, Resolution.Daily)) self.SetExecution(ImmediateExecutionModel()) self.SetPortfolioConstruction(InsightWeightingPortfolioConstructionModel()) self.SetRiskManagement(TrailingStopRiskManagementModel(0.03)) self.__numberOfSymbols = 10 self.stateData = {} def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data ''' # if not self.Portfolio.Invested: # self.SetHoldings("SPY", 1) pass def MyCoarseFilterFunction(self, coarse): # Get all symbols by dollar volume sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True) filtered = [x for x in sortedByDollarVolume if x.Price > 10 ][:5] for sec in filtered: if sec.Symbol not in self.stateData: self.stateData[sec.Symbol] = SelectionData(self, sec.Symbol, 14) rsiSelectionData = self.stateData[sec.Symbol] rsiSelectionData.update(sec.EndTime, sec.AdjustedPrice, sec.DollarVolume) validBuyValues = filter(lambda x : x.isBuyZone, self.stateData.values()) return [x.Symbol for x in filtered[:1] ] class SelectionData(object): def __init__(self, algo, symbol, period): self.symbol = symbol self.rsi = ExponentialMovingAverage(period) self.isBuyZone = False self.volume = 0 self.algo = algo def update(self, time, price, volume): self.algo.Debug('test') self.volume = volume self.rsi.Update(time, price) self.algo.Debug('rsi----') self.algo.Debug(self.rsi)