Calculation of MACD and log writing