MACD Help

So I’m currently going through the pip school and using MT4 as I follow along with the school. I have recently come to the part of the school where it goes over MACD. However mine only seems to show me my slow moving average and my histogram. Probably something super simple and laughable but I cannot for the life of me figure out how to get both lines with the histogram to appear. Any help would be greatly appreciated.

Hi Retnuh, the macD that comes with MT4 as standard is a bit odd, google another one, it’s quite a common issue :slight_smile:

(But as a side note, I’d recommend not bothering with the macD at all)

The MACD in MT4 is useless as you correctly pointed out that one MA is missing. I would use it on a different trading platform (unless you can find an EA for free which has a proper MACD).

Thanks guys, I was starting to feel crazy haha!

@jalapenoninja - What indicators would you recommend for someone just starting out, only reason I went with those on my paper account is because while I’m doing the babypips school I like to actually use what we’re going over so I can see it in action. Of course I will still follow my current behavior until I’m finished with school but I always appreciate advice from a vet.

@thelastbear - Haha, had to look up what an EA was. I’ll take your advice and look around at some other platforms.

There is nothing wrong with MT4’s Macd! MT4’s Macd is represented by the histogram, the Macd you saw in pip school with two lines, one is the signal which is exactly the same as the one in MT4 and the other line represents the Macd which is exactly the same as the MT4’s Macd histogram, if you load MT4’s Macd and then you load the Macd you see in pip school (which I’m including it here) you will notice that the Macd line will follow along the edge of the MT4’s Macd. The histogram you see on the macd at pip school does not represent the Macd value, that histogram tells you the distance between the Macd line and the Signal line and when they cross you will see this histogram crossing the 0 line also, so if you see the distance between these two line increasing you will see these bars of this histogram increase also and when you see the Macd crossing the signal line you will see this histogram crossing the 0 line and that is all it means, I myself prefer this Macd but just the lines I have no use whatsoever of this histogram so I removed it and I get this only:


Here’s a line macd with no histogram:

//+------------------------------------------------------------------+
//|                                                      newMACD.mq4 |
//|                                Copyright © 2005, David W. Thomas |
//|                                           mailto:[email protected] |
//+------------------------------------------------------------------+
// This is the correct computation and display of MACD.
#property copyright "Copyright © 2005, David W. Thomas"
#property link      "mailto:[email protected]"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 White
//---- input parameters
extern int FastMAPeriod = 12;
extern int SlowMAPeriod = 26;
extern int SignalMAPeriod = 9;
//---- buffers
double MACDLineBuffer[];
double SignalLineBuffer[];
//---- variables
double alpha = 0;
double alpha_1 = 0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   IndicatorDigits(Digits + 1);
   //---- indicators
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, MACDLineBuffer);
   SetIndexDrawBegin(0, SlowMAPeriod);
   SetIndexStyle(1, DRAW_LINE, STYLE_DOT);
   SetIndexBuffer(1, SignalLineBuffer);
   SetIndexDrawBegin(1, SlowMAPeriod + SignalMAPeriod);
   //---- name for DataWindow and indicator subwindow label
   IndicatorShortName("NMACD(" + FastMAPeriod+"," + SlowMAPeriod + "," + SignalMAPeriod + ")");
   SetIndexLabel(0, "NMACD");
   SetIndexLabel(1, "Signal");
   //----
	  alpha = 2.0 / (SignalMAPeriod + 1.0);
	  alpha_1 = 1.0 - alpha;
   //----
   return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   //----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars = IndicatorCounted();
   //---- check for possible errors
   if(counted_bars < 0) 
       return(-1);
   //---- last counted bar will be recounted
   if(counted_bars > 0) 
       counted_bars--;
   limit = Bars - counted_bars;
//----
   for(int i = limit; i >= 0; i--)
     {
       MACDLineBuffer[i] = iMA(NULL, 0, FastMAPeriod, 0, MODE_EMA, PRICE_CLOSE, i) - 
                           iMA(NULL, 0, SlowMAPeriod, 0, MODE_EMA, PRICE_CLOSE, i);
       SignalLineBuffer[i] = alpha*MACDLineBuffer[i] + alpha_1*SignalLineBuffer[i+1];
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Here’s a line macd with that little histogram:

//+------------------------------------------------------------------+
//|                                                      newMACD.mq4 |
//|                                Copyright © 2005, David W. Thomas |
//|                                           mailto:[email protected] |
//+------------------------------------------------------------------+
// This is the correct computation and display of MACD.
#property copyright "Copyright © 2005, David W. Thomas"
#property link      "mailto:[email protected]"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Green
//---- input parameters
extern int FastMAPeriod = 12;
extern int SlowMAPeriod = 26;
extern int SignalMAPeriod = 9;
//---- buffers
double MACDLineBuffer[];
double SignalLineBuffer[];
double HistogramBuffer[];
//---- variables
double alpha = 0;
double alpha_1 = 0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   IndicatorDigits(Digits + 1);
   //---- indicators
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, MACDLineBuffer);
   SetIndexDrawBegin(0, SlowMAPeriod);
   SetIndexStyle(1, DRAW_LINE, STYLE_DOT);
   SetIndexBuffer(1, SignalLineBuffer);
   SetIndexDrawBegin(1, SlowMAPeriod + SignalMAPeriod);
   SetIndexStyle(2, DRAW_HISTOGRAM);
   SetIndexBuffer(2, HistogramBuffer);
   SetIndexDrawBegin(2, SlowMAPeriod + SignalMAPeriod);
   //---- name for DataWindow and indicator subwindow label
   IndicatorShortName("NMACD(" + FastMAPeriod+"," + SlowMAPeriod + "," + SignalMAPeriod + ")");
   SetIndexLabel(0, "NMACD");
   SetIndexLabel(1, "Signal");
   SetIndexLabel(2, "Histogr");   
   //----
	  alpha = 2.0 / (SignalMAPeriod + 1.0);
	  alpha_1 = 1.0 - alpha;
   //----
   return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   //----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars = IndicatorCounted();
   //---- check for possible errors
   if(counted_bars < 0) 
       return(-1);
   //---- last counted bar will be recounted
   if(counted_bars > 0) 
       counted_bars--;
   limit = Bars - counted_bars;
//----
   for(int i = limit; i >= 0; i--)
     {
       MACDLineBuffer[i] = iMA(NULL, 0, FastMAPeriod, 0, MODE_EMA, PRICE_CLOSE, i) - 
                           iMA(NULL, 0, SlowMAPeriod, 0, MODE_EMA, PRICE_CLOSE, i);
       SignalLineBuffer[i] = alpha*MACDLineBuffer[i] + alpha_1*SignalLineBuffer[i+1];
       HistogramBuffer[i] = MACDLineBuffer[i] - SignalLineBuffer[i];
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Good luck.

1 Like