macd and macd histogram

 
I've been trying to have MACD and it's histogram in the same windwo to no avail does anyone have any suggestion
 
I am not sure what do You mean. There may be some mistakes in terminology.
You mean combine 2 indicators:
1. MACD 2 lines - 1-st line is divergence between fast and slow MA; 2-nd - line is signal line (MA on 1-st line)
2. MACD histogram (Moving Average of Oscillator, OsMA in MT terms) - histogram is divergence between 1-st ane 2-nd MACD lines
//+------------------------------------------------------------------+ //| MACD-combine.mq4 | //| Copyright © 2006, MetaQuotes Software Corp. | //| https://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, MetaQuotes Software Corp." #property link "https://www.metaquotes.net/" #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_color3 Silver //---- input parameters extern int ExtFastEMA=12; extern int ExtSlowEMA=26; extern int ExtSignalSMA=9; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexBuffer(2,ExtMapBuffer3); //---- SetIndexDrawBegin(1,ExtSignalSMA); SetIndexDrawBegin(2,ExtSignalSMA); IndicatorDigits(Digits+2); IndicatorShortName("MACD-combo("+ExtFastEMA+","+ExtSlowEMA+","+ExtSignalSMA+")"); SetIndexLabel(0,"MACD"); SetIndexLabel(1,"Signal"); SetIndexLabel(2,"OsMA"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- macd for(int i=0; i<limit; i++) ExtMapBuffer1[i]=iMA(NULL,0,ExtFastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,ExtSlowEMA,0,MODE_EMA,PRICE_CLOSE,i); //---- signal for(i=0; i<limit; i++) ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer1,Bars,ExtSignalSMA,0,MODE_SMA,i); //---- osma for(i=0; i<limit; i++) ExtMapBuffer3[i]=ExtMapBuffer1[i]-ExtMapBuffer2[i]; //---- done return(0); } //+------------------------------------------------------------------+
 
Try this file!!!
Files:
 

Could someone please help me, I'm fairly new to trading and only learning a few basic indicators, the MACD being one of them. I have used this tool on other platforms and they seem to be different from the one on Meta trader 4? As i said, I'm still learning so am not very big on all the tool names and its components so my description may not be very clear as to my problem.

The other MACD's i have seen consist of 2 moving averages which usually highlight a signal on crossover.

Mine seems to have 1 line and a histogram which i really find hard to read??

I would be very grateful if anyone could offer me any help on how to resolve this issue??


Ian

 
iannai69:

Could someone please help me, I'm fairly new to trading and only learning a few basic indicators, the MACD being one of them. I have used this tool on other platforms and they seem to be different from the one on Meta trader 4? As i said, I'm still learning so am not very big on all the tool names and its components so my description may not be very clear as to my problem.

Please do not double post: https://www.mql5.com/en/forum/141628

Please do not dredge up threads that are 6 years old ! !

Reason: