Navigation:Home > Content >

MACD_DuoHistogram.mq4

Time: 2011-07-08 | Download file:MACD_DuoHistogram.mq4

//+------------------------------------------------------------------+
//|                                                     MACD_Duo.mq4 |
//|                               Copyright © 2009, Glordon Software |
//|                                    http://www.tradersunion.at.ua |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Glordon Software"
#property link      "http://www.tradersunion.at.ua"

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 DeepSkyBlue
#property indicator_color3 Lime
#property indicator_color4 Gold
//---- input parameters
extern string str1="Параметры MACD";
extern int    Fast=6;
extern int    Slow=24;
extern int    Signal=9;
extern string str2="Вкл./Выкл. сигнальные линии.";
extern bool EnableSig=true;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,3);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,3);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,2);
   SetIndexBuffer(3,ExtMapBuffer4);

   IndicatorShortName("MACD_Duo Histogram("+Fast+","+Slow+","+Signal+")");
   SetIndexLabel(0,"MACD Current");
   SetIndexLabel(1,"MACD High");
   SetIndexLabel(2,"MACD Current Signal");
   SetIndexLabel(3,"MACD High Signal");
//----
   return(0);
  }
void Get_MACD()
{
int timeframe;
   if (Period()==1)timeframe=5;
    else if (Period()==5)timeframe=15;
     else if (Period()==15)timeframe=30;
      else if (Period()==30)timeframe=60;
       else if (Period()==60)timeframe=240;
        else if (Period()==240)timeframe=1440;
         else if (Period()==1440)timeframe=10080;
          else if (Period()==10080)timeframe=43200;
         else timeframe=0;
   int    i,pos=Bars;
//---- initial accumulation
   
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
   for(i=0; i        

Recommend