y_fde = apply_ema_poly1_filter(prices, Neff) h_ema_poly1 = ema_poly1(Neff, Nwindow) candidate = np.convolve(prices - prices[0], h_ema_poly1) + prices[0] y_convolution = candidate[:len(prices)] axarr[1, 1].set_title("Ema poly1") axarr[1, 1].plot(y_fde) axarr[1, 1].plot(y_convolution, 'o', markerfacecolor='none') # e) Integrated Macd-Poly Neff = 32 lag = 3 y_fde = apply_integrated_macd_poly_filter(prices, Neff) h_int_macd_poly = int_macd_poly(Neff, Nwindow) candidate = np.convolve(prices - prices[0], h_int_macd_poly) + prices[0] y_convolution = candidate[:len(prices)] axarr[2, 0].set_title("Integrated macd poly") axarr[2, 0].plot(y_fde) axarr[2, 0].plot(y_convolution, 'o', markerfacecolor='none') # f) Macd Neff_pos = 16 Neff_neg = 32 lag = 2 y_fde = apply_macd_filter(prices, Neff_pos, Neff_neg)
impulse_response_direct = ema_poly1(Neff, Nwindow) axarr[1, 1].set_title("Ema poly1") axarr[1, 1].plot(impulse_response_fde) axarr[1, 1].plot(impulse_response_direct, 'o', markerfacecolor='none') # e) Integrated Macd-Poly Neff = 32 Neff_modified = 32 lag = 3 impulse = np.zeros(Nwindow) impulse[lag] = 1 candidate = apply_integrated_macd_poly_filter(impulse, Neff) impulse_response_fde = candidate[lag:] impulse_response_direct = int_macd_poly(Neff_modified, Nwindow) axarr[2, 0].set_title("Integrated Macd-Poly") axarr[2, 0].plot(impulse_response_fde) axarr[2, 0].plot(impulse_response_direct, 'o', markerfacecolor='none') # f) Macd Neff_pos = 16 Neff_neg = 32 lag = 2 impulse = np.zeros(Nwindow) impulse[lag] = 1