MACD signal line

 

Good day, New coder here


I have been perusing on the net for a code that uses the signal line not the histogram and I have not found any knowledge how to do this.

Can I please ask if its possible to use this line in the expert code and if yes please help or point me in the right direction

Files:
 
Moses Mad:

Good day, New coder here


I have been perusing on the net for a code that uses the signal line not the histogram and I have not found any knowledge how to do this.

Can I please ask if its possible to use this line in the expert code and if yes please help or point me in the right direction

MT4 version:

double MACD_Signal=iMACD(_Symbol,PERIOD_CURRENT,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0);

MT5 version: (more info at https://www.mql5.com/en/docs/indicators/imacd)

int handle
double SignalBuffer[];

int Maxbars=20;

int OnInit()
{
 handle=iMACD(_Symbol,0,12,26,9,PRICE_CLOSE);

 return 0;
}

void OnTick()
{
 CopyBuffer(handle,1,0,Maxbars,SignalBuffer);

 if(SignalBuffer[0]>SignalBuffer[1])
  {
   //do something
  }

}
Documentation on MQL5: Technical Indicators / iMACD
Documentation on MQL5: Technical Indicators / iMACD
  • www.mql5.com
//|                                                   Demo_iMACD.mq5 | //|                        Copyright 2011, MetaQuotes Software Corp. | //|                                             https://www.mql5.com | "The method of creation of the handle is set through the 'type' parameter (function type...
 
He mentions "I want to know how to display lines instead of histograms", doesn't he?

In that case, all he has to do is modify DRAW _ HISTOGRAM to DRAW _ LINE.

//--- the MACD plot 
#property indicator_label1  "MACD" 
#property indicator_type1   DRAW_LINE  //DRAW_HISTOGRAM 
#property indicator_color1  clrSilver 
#property indicator_style1  STYLE_SOLID 
#property indicator_width1  1 
Reason: