Color MACD Indicator For MT5

Color MACD Indicator For MT5

Table Of Contents:

  1. Color MACD Indicator For MT5
  2. Installing the Color MACD Indicator For MT5
  3. Parameters of the Color MACD Indicator For MT5
  4. Buffers of the Color MACD Indicator For MT5
  5. Main Parts Of The Code

The Color MACD Indicator For MT5 draws a colored MACD on the histogram subwindow. As a special feature you can select an averaging/smoothing algorithm for the MACD. The colors of the histogram are depending on the values. The signal line is green on rising values. On declining values the signal line is red.

FREE ColorMACD Indicator

Download the FREE ColorMACD Indicator for MT5.

To receive my email 100% sure: 
Put my email on your whitelist!


Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur


Installing the Color MACD Indicator For MT5

After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file colormacd.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.

Parameters of the Color MACD Indicator For MT5

The Color MACD Indicator For MT5 has 5 parameters to configure.

input int Fast_MA = 12; //Fast moving average period input int Slow_MA = 26; //SMMA smoothing depth input ENUM_MA_METHOD MA_Method_=MODE_EMA; //Indicator averaging method input int Signal_SMA=9; //Signal line period input Applied_price_ AppliedPrice=PRICE_CLOSE_;//Price constant 

Buffers of the Color MACD Indicator For MT5

The Color MACD Indicator For MT5 provides 4 buffers.

SetIndexBuffer(0,MACDBuffer,INDICATOR_DATA); SetIndexBuffer(1,ColorMACDBuffer,INDICATOR_COLOR_INDEX); SetIndexBuffer(2,SignBuffer,INDICATOR_DATA); SetIndexBuffer(3,ColorSignBuffer,INDICATOR_COLOR_INDEX); 

Main Parts Of The Code

int OnCalculate(                 const int rates_total,    // number of bars in history at the current tick                 const int prev_calculated,// number of bars calculated at previous call                 const datetime &time[],                 const double &open[],                 const double &high[],                 const double &low[],                 const double &close[],                 const long &tick_volume[],                 const long &volume[],                 const int &spread[]                 )   { //---- Checking the number of bars to be enough for the calculation    if(rates_total lt start) return(0);  //---- Declaration of integer variables    int first1,first2,first3,bar; //---- Declaration of variables with a floating point      double price_,fast_ma,slow_ma;  //---- Initialization of the indicator in the OnCalculate() block    if(prev_calculated gt rates_total || prev_calculated lt =0)// checking for the first start of calculation of an indicator      {       first1=0;            // starting number for calculation of all first loop bars       first2=macd_start+1; // starting number for calculation of all second loop bars       first3=start+1;      // starting number for calculation of all third loop bars      }    else // starting number for calculation of new bars      {       first1=prev_calculated-1;       first2=first1;       first3=first1;      }  //---- declaration of variables of the CMoving_Average class from the file MASeries_Cls.mqh    static CMoving_Average MA1,MA2,MA3;  //---- Main loop of the indicator calculation    for(bar=first1; bar lt rates_total; bar++)      {       price_=PriceSeries(AppliedPrice,bar,open,low,high,close);        fast_ma = MA1.MASeries(0, prev_calculated, rates_total, Fast_MA, MA_Method_, price_, bar, false);       slow_ma = MA2.MASeries(0, prev_calculated, rates_total, Slow_MA, MA_Method_, price_, bar, false);        MACDBuffer[bar]=fast_ma-slow_ma;        SignBuffer[bar]=MA3.SMASeries(macd_start,prev_calculated,rates_total,Signal_SMA,MACDBuffer[bar],bar,false);      }  //---- Main loop of the MACD indicator coloring    for(bar=first2; bar lt rates_total; bar++)      {       ColorMACDBuffer[bar]=0;        if(MACDBuffer[bar] gt 0)         {          if(MACDBuffer[bar] gt MACDBuffer[bar-1]) ColorMACDBuffer[bar]=1;          if(MACDBuffer[bar] lt MACDBuffer[bar-1]) ColorMACDBuffer[bar]=2;         }        if(MACDBuffer[bar] lt 0)         {          if(MACDBuffer[bar] lt MACDBuffer[bar-1]) ColorMACDBuffer[bar]=3;          if(MACDBuffer[bar] gt MACDBuffer[bar-1]) ColorMACDBuffer[bar]=4;         }      }  //---- Main loop of the signal line coloring    for(bar=first3; bar lt rates_total; bar++)      {       ColorSignBuffer[bar]=0;       if(MACDBuffer[bar] gt SignBuffer[bar-1]) ColorSignBuffer[bar]=1;       if(MACDBuffer[bar] lt SignBuffer[bar-1]) ColorSignBuffer[bar]=2;      } //----         return(rates_total);   } //+------------------------------------------------------------------+ 


About Me

I'm Mike Semlitsch the owner of My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group

Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.