ZigZag33





// ÇèãÇàã.mq4
// Èíäèêàòîð ÇèãÇàã â ñòèëå Ðåíêî è Êðåñòèêè-Íîëèêè

#property copyright "mandorr@gmail.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Violet
#property indicator_width1 1
#property indicator_style1 0

extern int  BoxSize=50;       // Ðàçìåð êèðïè÷à â ïèïñàõ

double buffer0[];

int      MySize;
double   size;

void init() {
   int MinStop;

   MinStop=MarketInfo(Symbol(),MODE_STOPLEVEL);
   MySize=BoxSize; if (MySize<MinStop && MinStop>0) {MySize=MinStop;}
   size=MySize*Point;

   SetIndexStyle (0,DRAW_SECTION);
   SetIndexBuffer(0,buffer0);
   SetIndexLabel (0,"Çíà÷åíèå");
   SetIndexDrawBegin(0,0);

   IndicatorShortName("ÇèãÇàã ("+MySize+" ïèïñîâ)");
}

void deinit() {
}

void start() {
   int count, d, d1, i, h_shift, l_shift;
   double h, l, H, L;
   count=Bars-1;
   d=0;
   h=(High[count]+Low[count]+size)/2;
   l=(High[count]+Low[count]-size)/2;
   h_shift=count;
   l_shift=count;
   buffer0[count]=EMPTY_VALUE;
   for (i=count-1; i>=0; i--) {
      d1=d;
      H=High[i];
      L=Low [i];
      if (H-L>size) {
         if (H-h>=l-L) {d= 1; h=H; l=h-size; h_shift=i;}
         else          {d=-1; l=L; h=l+size; l_shift=i;}
      }
      else {
         if (H>h && L>=l) {d= 1; h=H; l=h-size; h_shift=i;}
         if (L<l && H<=h) {d=-1; l=L; h=l+size; l_shift=i;}
      }
      H=High[h_shift];
      L=Low [l_shift];
      if (d>0 && d1<0) {buffer0[l_shift]=L;}
      if (d<0 && d1>0) {buffer0[h_shift]=H;}
   }
   H=High[h_shift];
   L=Low [l_shift];
   if (d>0) {buffer0[h_shift]=H;}
   if (d<0) {buffer0[l_shift]=L;}
}





Sample





Analysis



Market Information Used:

Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar


Indicator Curves created:



Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: