Heiken_Ashi_ZMa





//+------------------------------------------------------------------+
//|                        Heiken Ashi ZMa.mq4                       |
//+------------------------------------------------------------------+
//____________________________\¦/
//___________________________(ò ó)
//______________________o0o___(_)___o0o__
//___¦_____¦_____¦_____¦_____¦_____¦_____¦
//¦_____¦_____¦_____¦_____¦_____¦_____¦__
//___¦_____¦_____¦_____¦_____¦_____¦_____¦
//¦_____¦_____¦_____¦_____¦_____¦_____¦__
#property copyright "Copyright © 2006, Forex-TSD.com "
#property link      "http://www.forex-tsd.com/"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_color3 Red
#property indicator_color4 Green
extern int Lengthzma2 = 50;
extern int Lengthzma3 = 50;
extern int nZLMASmMethod= 1;
extern int nZLMAMethod= 1;
extern int nZLMAShift=0;
extern int nZLMASmShift=0;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
int ExtCountedBars=0;
int init()
  {
   SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, Red);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, Green);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexStyle(2,DRAW_HISTOGRAM, 0, 2, Red);
   SetIndexBuffer(2, ExtMapBuffer3);
   SetIndexStyle(3,DRAW_HISTOGRAM, 0, 2, Green);
   SetIndexBuffer(3, ExtMapBuffer4);
   SetIndexDrawBegin(0,5);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexBuffer(3,ExtMapBuffer4);
   return(0);
  }
int start()
  {
   double maOpen, maClose, maLow, maHigh;
   double haOpen, haHigh, haLow, haClose;
   if(Bars<=10) return(0);
   ExtCountedBars=IndicatorCounted();
   if (ExtCountedBars<0) return(-1);
   if (ExtCountedBars>0) ExtCountedBars--;
   int i=Bars-ExtCountedBars-1;
   while(i>=0)
     {
      maOpen=iCustom(Symbol(),0,"ZeroLAG MA",Lengthzma2,0,nZLMAMethod,1,Lengthzma3,0,nZLMASmMethod,0,i);
      maClose=iCustom(Symbol(),0,"ZeroLAG MA",Lengthzma2,0,nZLMAMethod,0,Lengthzma3,0,nZLMASmMethod,0,i);
      maLow=iCustom(Symbol(),0,"ZeroLAG MA",Lengthzma2,0,nZLMAMethod,3,Lengthzma3,0,nZLMASmMethod,0,i);
      maHigh=iCustom(Symbol(),0,"ZeroLAG MA",Lengthzma2,0,nZLMAMethod,2,Lengthzma3,0,nZLMASmMethod,0,i);

      haOpen=(ExtMapBuffer3[i+1]+ExtMapBuffer4[i+1])/2;
      haClose=(maOpen+maHigh+maLow+maClose)/4;
      haHigh=MathMax(maHigh, MathMax(haOpen, haClose));
      haLow=MathMin(maLow, MathMin(haOpen, haClose));
      if (haOpen<haClose) 
        {
         ExtMapBuffer1[i]=haLow;
         ExtMapBuffer2[i]=haHigh;
        } 
      else
        {
         ExtMapBuffer1[i]=haHigh;
         ExtMapBuffer2[i]=haLow;
        } 
      ExtMapBuffer3[i]=haOpen;
      ExtMapBuffer4[i]=haClose;
 	   i--;
     }
   return(0);
  }



Sample





Analysis



Market Information Used:



Indicator Curves created:

Implements a curve of type DRAW_HISTOGRAM


Indicators Used:




Custom Indicators Used:
ZeroLAG MA

Order Management characteristics:

Other Features: