#MTF_NonLagMA_v4.mtf





//+------------------------------------------------------------------+
//|                                                  NonLagMA_v4.mq4 |
//|                                Copyright © 2006, TrendLaboratory |
//|            http://finance.groups.yahoo.com/group/TrendLaboratory |
//|                                   E-mail: igorad2003@yahoo.co.uk |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, TrendLaboratory"
#property link      "http://finance.groups.yahoo.com/group/TrendLaboratory"


#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_width1 2
#property indicator_color2 SkyBlue
#property indicator_width2 2
#property indicator_color3 Tomato
#property indicator_width3 2


//---- input parameters
extern int     TimeFrame      = 0;
extern int     Price          = 0;
extern int     Length         = 9;
extern int     Displace       = 0;
extern int     Filter         = 0;
extern int     Color          = 1;
extern int     ColorBarBack   = 0;
extern double  Deviation      = 0;         

double Cycle =  4;

//---- indicator buffers
double MABuffer[];
double UpBuffer[];
double DnBuffer[];
double price[];
double trend[];




//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
  int init()
  {
   int ft=0;
   string short_name;
//---- indicator line
   IndicatorBuffers(5);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,MABuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,UpBuffer);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,DnBuffer);
   SetIndexBuffer(3,price);
   SetIndexBuffer(4,trend);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- name for DataWindow and indicator subwindow label
      switch(TimeFrame)
     {
       case 1 : string TimeFrameStr="Period_M1"; break;
       case 5 : TimeFrameStr="Period_M5"; break;
       case 15 : TimeFrameStr="Period_M15"; break;
       case 30 : TimeFrameStr="Period_M30"; break;
       case 60 : TimeFrameStr="Period_H1"; break;
       case 240 : TimeFrameStr="Period_H4"; break;
       case 1440 : TimeFrameStr="Period_D1"; break;
       case 10080 : TimeFrameStr="Period_W1"; break;
       case 43200 : TimeFrameStr="Period_MN1"; break;
       default : TimeFrameStr="Current Timeframe";
     }
   IndicatorShortName("NonLagMa("+TimeFrameStr+")");   
  }
//----
   return(0);
 

//+------------------------------------------------------------------+
//| NonLagMA_v4                                                     |
//+------------------------------------------------------------------+
int start()
{
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();
 
// Plot defined time frame on to current time frame
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   
   limit=Bars-counted_bars;
   for(i=0,y=0;i<limit;i++)
   {
   if (Time[i]<TimeArray[y]) y++;
   MABuffer[i]=iCustom(NULL,TimeFrame,"NonLagMA_v4",Price,Length,Displace,Filter,Color,ColorBarBack,Deviation,Cycle,0,y);
   UpBuffer[i]=iCustom(NULL,TimeFrame,"NonLagMA_v4",Price,Length,Displace,Filter,Color,ColorBarBack,Deviation,Cycle,1,y);
   DnBuffer[i]=iCustom(NULL,TimeFrame,"NonLagMA_v4",Price,Length,Displace,Filter,Color,ColorBarBack,Deviation,Cycle,2,y);
   price[i]=iCustom(NULL,TimeFrame,"NonLagMA_v4",Price,Length,Displace,Filter,Color,ColorBarBack,Deviation,3,y);
   trend[i]=iCustom(NULL,TimeFrame,"NonLagMA_v4",Price,Length,Displace,Filter,Color,ColorBarBack,Deviation,4,y);
 
   }
   
//

   return(0);
   }
//+---------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains open time of each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:




Custom Indicators Used:
NonLagMA_v4

Order Management characteristics:

Other Features: