Hi there! I'm having some hard time trying to filter weekly data with US Equity Pricing inside a Custom Factor. I would like to compute MACD for a weekly timeframe. Do you have any clues how to do it. I've researched a little bit between old posts I tried things like this one :
input = [USEquityPricing.close.downsample('week_start')] but that throw me some errors.
class GetMacDHistSlope(CustomFactor): #inputs = [USEP.close] inputs = [USEP.close.latest.downsample('week_start')] window_length = 50 def compute(self, today, assets, out, close): hists =  for stock_close in close.T: try: #Compute only end of week equity prices!! macd, signal, hist = talib.MACD(stock_close, fastperiod=12, slowperiod=26, signalperiod=9) if (hist[-3] > hist[-2]) and (hist[-2] > hist[-1]): trend = -1 elif (hist[-3] < hist[-2]) and (hist[-2] < hist[-1]): trend = 1 else: trend = 0 hists.append(trend) except: hists.append(np.nan) out[:] = hists
NonWindowSafeInput: Can't compute windowed expression GetMacDHistSlope([DownsampledFactor(...)], 50) with windowed input DownsampledFactor([EquityPricing<US>.close], 1).