ZeroLag MACD Indicator For MT5

ZeroLag MACD Indicator For MT5

Table Of Contents:

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

The ZeroLag MACD Indicator For MT5 is a modified version of the original MACD and gives earlier signals. Because of the earlier signals this MACD is called ZeroLag.

FREE ZeroLag MACD Indicator

Download the FREE ZeroLag MACD 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 ZeroLag 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 zerolag_macd.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 ZeroLag MACD Indicator For MT5

The ZeroLag MACD Indicator For MT5 has 3 parameters to configure.

input int                InpFastEMA=12;               // Fast EMA period input int                InpSlowEMA=26;               // Slow EMA period input ENUM_APPLIED_PRICE InpAppliedPrice=PRICE_CLOSE; // Applied price 

Buffers of the ZeroLag MACD Indicator For MT5

The ZeroLag MACD Indicator For MT5 provides 7 buffers.

SetIndexBuffer(0,ExtMacdBuffer,INDICATOR_DATA); SetIndexBuffer(1,ExtMacdUpBuffer,INDICATOR_DATA); SetIndexBuffer(2,ExtMacdDownBuffer,INDICATOR_DATA); SetIndexBuffer(3,ExtFastMaBuffer,INDICATOR_CALCULATIONS); SetIndexBuffer(4,ExtSlowMaBuffer,INDICATOR_CALCULATIONS); SetIndexBuffer(5,ExtFastResMaBuffer,INDICATOR_CALCULATIONS); SetIndexBuffer(6,ExtSlowResMaBuffer,INDICATOR_CALCULATIONS); 

Main Parts Of The Code

int OnCalculate(const int rates_total,const int prev_calculated,                 const datetime &Time[],                 const double &Open[],                 const double &High[],                 const double &Low[],                 const double &Close[],                 const long &TickVolume[],                 const long &Volume[],                 const int &Spread[])   { //--- check for data    if(rates_total lt InpFastEMA)       return(0); //--- not all data may be calculated    int calculated=BarsCalculated(ExtFastMaHandle);    if(calculated lt rates_total)      {       Print("Not all data of ExtFastMaHandle is calculated (",calculated,"bars ). Error",GetLastError());       return(0);      }    calculated=BarsCalculated(ExtSlowMaHandle);    if(calculated lt rates_total)      {       Print("Not all data of ExtSlowMaHandle is calculated (",calculated,"bars ). Error",GetLastError());       return(0);      } //--- we can copy not all data    int to_copy;    if(prev_calculated gt rates_total || prev_calculated lt 0) to_copy=rates_total;    else      {       to_copy=rates_total-prev_calculated;       if(prev_calculated gt 0) to_copy++;      } //--- get Fast EMA buffer    if(CopyBuffer(ExtFastMaHandle,0,0,to_copy,ExtFastMaBuffer) lt =0)      {       Print("Getting fast EMA is failed! Error",GetLastError());       return(0);      } //--- get SlowSMA buffer    if(CopyBuffer(ExtSlowMaHandle,0,0,to_copy,ExtSlowMaBuffer) lt =0)      {       Print("Getting slow SMA is failed! Error",GetLastError());       return(0);      } //---    int limit;    if(prev_calculated==0)       limit=0;    else limit=prev_calculated-1; //--- calculate MACD    ExtMacdUpBuffer[0]=0;    ExtMacdDownBuffer[0]=0;    ExponentialMAOnBuffer(rates_total,prev_calculated,0,InpFastEMA,ExtFastMaBuffer,ExtFastResMaBuffer);    ExponentialMAOnBuffer(rates_total,prev_calculated,0,InpSlowEMA,ExtSlowMaBuffer,ExtSlowResMaBuffer);    for(int i=limit;i lt rates_total;i++)      {       ExtMacdBuffer[i]=10*((2*ExtFastMaBuffer[i]-ExtFastResMaBuffer[i]) -(2*ExtSlowMaBuffer[i]-ExtSlowResMaBuffer[i]));       if(i gt 0)         {          if(ExtMacdBuffer[i] gt ExtMacdBuffer[i-1])            {             ExtMacdUpBuffer[i]=ExtMacdBuffer[i];             ExtMacdDownBuffer[i]=0;            }          else            {             ExtMacdDownBuffer[i]=ExtMacdBuffer[i];             ExtMacdUpBuffer[i]=0;            }         }      } //-0.-- OnCalculate done. Return new prev_calculated.    return(rates_total);   } //+------------------------------------------------------------------+ 

 

About Me

I'm Mike Semlitsch the owner of PerfectTrendSystem.com. 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.