Implement the macd