3ColorMACD Indicator For MT4
The 3ColorMACD Indicator For MT4 works more like the traditional MACD indicator with much more advanced functionality. Blue bars in the positive side of the reference zero line indicators buyers are in control and on the negative side indicates, the buyers are slowly gaining momentum. On the contrary, red bars on the negative side indicate the sellers are in control and on the positive side indicates, the buyers are slowly losing strength.
Installing the 3ColorMACD Indicator For MT4
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file 3colormacd.mq4 into the folder MQL4\Indicators of your MT4 installation. After that please restart MT4 and then you will be able to see the indicator in the list of indicators.
Parameters of the 3ColorMACD Indicator For MT4
The 3ColorMACD Indicator For MT4 has 6 parameters to configure.
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
extern int CountBars=300;
extern int Line=3;
extern double Zero_level=0.0;
Buffers of the 3ColorMACD Indicator For MT4
The 3ColorMACD Indicator For MT4 provides 6 buffers.
SetIndexBuffer(0,ind_buffer1);
SetIndexBuffer(1,ind_buffer2);
SetIndexBuffer(2,ind_buffer3);
SetIndexBuffer(3,ind_buffer4);
SetIndexBuffer(4,ind_buffer5);
SetIndexBuffer(5,ind_buffer6);
Main Parts Of The Code
int start()
{
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,Line);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,Line);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,Line);
SetIndexStyle(3,DRAW_LINE,STYLE_DASHDOTDOT,1);
SetIndexStyle(4,DRAW_LINE,STYLE_DASHDOTDOT,1);
int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars lt 0) return(-1);
//---- last counted bar will be recounted
if(counted_bars gt 0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=0; i lt limit; i++)
{
ind_buffer6[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
}
//---- Three Colour MACD mapping
for(i=0; i lt limit-1; i++)
{
ind_buffer5[i]=Zero_level;
Vol=ind_buffer6[i]; delta=Vol-ind_buffer6[i+1];
if(delta gt 0.0){ind_buffer1[i]=Vol; ind_buffer2[i]=0.0; ind_buffer3[i]=0.0;}
else
{
if(delta lt 0.0){ind_buffer1[i]=0.0; ind_buffer2[i]=Vol; ind_buffer3[i]=0.0;}
else {ind_buffer1[i]=0.0; ind_buffer2[i]=0.0; ind_buffer3[i]=Vol;}
}
//----
}
//---- signal line counted in the 2-nd buffer
for(i=0; i lt limit; i++)
ind_buffer4[i]=iMAOnArray(ind_buffer6,Bars,SignalSMA,0,MODE_SMA,i);
//---- done
return(0);
}
//+------------------------------------------------------------------+