//+------------------------------------------------------------------+
//|                                                 MTF ZLagMACD     |
//+------------------------------------------------------------------+
//2008fxtsd
#property copyright "Copyright © 2006, Keris2112"
#property link      "http://www.forex-tsd.com"
#property indicator_separate_window
#property  indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Orange
#property indicator_style2 2
extern int TimeFrame=0;
extern int       FastEMA=12;
extern int       SlowEMA=26;
extern int       SignalEMA=9;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//-----
int init()
  {
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
//   SetIndexStyle(0,DRAW_SECTION,STYLE_SOLID,1);
//   SetIndexStyle(1,DRAW_SECTION,STYLE_SOLID,1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(0,SlowEMA);
   SetIndexDrawBegin(1,SlowEMA);
//----   
      switch(TimeFrame)
      {
      case 1 : string TimeFrameStr="M1"; break;
      case 5 : TimeFrameStr="M5"; break;
      case 15 : TimeFrameStr="M15"; break;
      case 30 : TimeFrameStr="M30"; break;
      case 60 : TimeFrameStr="H1"; break;
      case 240 : TimeFrameStr="H4"; break;
      case 1440 : TimeFrameStr="D1"; break;
      case 10080 : TimeFrameStr="W1"; break;
      case 43200 : TimeFrameStr="MN"; break;
      default : TimeFrameStr="TF0";
      } 
   
   TimeFrame= MathMax(TimeFrame, Period());
   string short_name;
   short_name="ZeroLagMACD  ("+FastEMA + ", "+SlowEMA+ ", "+SignalEMA+") ["+TimeFrameStr+"] ";
   IndicatorShortName(short_name);  
  
   SetIndexLabel(0,short_name);
   SetIndexLabel(1,"Sig"+short_name);
  }
   return(0);
 
//+--------
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();
   if (counted_bars<0) return(-1);
   if (counted_bars>0) counted_bars--;
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   
   limit=Bars-counted_bars;
   limit = MathMax(limit,TimeFrame/Period());
   for(i=0,y=0;i<limit;i++)
   {
   if (Time[i]<TimeArray[y]) y++; 
   
   ExtMapBuffer1[i]=iCustom(NULL,TimeFrame,"MACD_zlagmacd",FastEMA,SlowEMA,SignalEMA,0,y);
   ExtMapBuffer2[i]=iCustom(NULL,TimeFrame,"MACD_zlagmacd",FastEMA,SlowEMA,SignalEMA,1,y);
   }  
     
   return(0);
  }
//+------------------------------------------------------------------+
Comments