Author of the idea — Gabriel, author of the MQL5 code — barabashkakvn.
Works based on the iMACD (MACD) indicators.
Conditions to check the signals for opening a position:
void OpenBuyOrSell()
  {
  double mac1,mac2,mac3,mac4,mac5,mac6,mac7,mac8;
  mac1 = iMACDGet(MAIN_LINE,0);
  mac2 = iMACDGet(MAIN_LINE,1);
  mac3 = iMACDGet(MAIN_LINE,2);
  mac4 = iMACDGet(MAIN_LINE,3);
  mac5 = iMACDGet(SIGNAL_LINE,0);
  mac6 = iMACDGet(SIGNAL_LINE,1);
  mac7 = iMACDGet(SIGNAL_LINE,2);
  mac8 = iMACDGet(SIGNAL_LINE,3);
//— check for long position (BUY) possibility
  if(mac8>mac7 && mac7>mac6 && mac6<mac5 && mac4>mac3 && mac3<mac2 && mac2<mac1 && mac2<-0.00020 && mac4<0 && mac1>0.00020)
    {
      if(!RefreshRates())
        return;
      double volume=LotsOptimized();
      if(volume==0)
        return;
      m_trade.Buy(volume,Symbol(),m_symbol.Bid(),0,0,“Expert MACD”);
      return;
    }
//— check for short position (SELL) possibility
  if(mac8<mac7 && mac7<mac6 && mac6>mac5 && mac4<mac3 && mac3>mac2 && mac2>mac1 && mac2>0.00020 && mac4>0 && mac1<-0.00035)
    {
      if(!RefreshRates())
        return;
      double volume=LotsOptimized();
      if(volume==0)
        return;
      m_trade.Sell(volume,Symbol(),m_symbol.Ask(),0,0,“Expert MACD”);
      return;
    }
  }
  {
  double mac1,mac2,mac3,mac4,mac5,mac6,mac7,mac8;
  mac1 = iMACDGet(MAIN_LINE,0);
  mac2 = iMACDGet(MAIN_LINE,1);
  mac3 = iMACDGet(MAIN_LINE,2);
  mac4 = iMACDGet(MAIN_LINE,3);
  mac5 = iMACDGet(SIGNAL_LINE,0);
  mac6 = iMACDGet(SIGNAL_LINE,1);
  mac7 = iMACDGet(SIGNAL_LINE,2);
  mac8 = iMACDGet(SIGNAL_LINE,3);
//— check for long position (BUY) possibility
  if(mac8>mac7 && mac7>mac6 && mac6<mac5 && mac4>mac3 && mac3<mac2 && mac2<mac1 && mac2<-0.00020 && mac4<0 && mac1>0.00020)
    {
      if(!RefreshRates())
        return;
      double volume=LotsOptimized();
      if(volume==0)
        return;
      m_trade.Buy(volume,Symbol(),m_symbol.Bid(),0,0,“Expert MACD”);
      return;
    }
//— check for short position (SELL) possibility
  if(mac8<mac7 && mac7<mac6 && mac6>mac5 && mac4<mac3 && mac3>mac2 && mac2>mac1 && mac2>0.00020 && mac4>0 && mac1<-0.00035)
    {
      if(!RefreshRates())
        return;
      double volume=LotsOptimized();
      if(volume==0)
        return;
      m_trade.Sell(volume,Symbol(),m_symbol.Ask(),0,0,“Expert MACD”);
      return;
    }
  }
Opening Buy on the chart:
Â