<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>forex decode</title>
	
	<link>http://forexdecode.com</link>
	<description />
	<pubDate>Thu, 16 Jul 2009 21:04:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/forexdecode" /><feedburner:info uri="forexdecode" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>forexdecode</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>9yrzi3pm5k</title>
		<link>http://feedproxy.google.com/~r/forexdecode/~3/66ySvRSHohQ/</link>
		<comments>http://forexdecode.com/9yrzi3pm5k/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 21:04:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[yrzi]]></category>

		<guid isPermaLink="false">http://forexdecode.com/?p=1005</guid>
		<description><![CDATA[9yrzi3pm5k
 Tweet This Post&#160;  Delicious This Post&#160;  Ping This Post&#160;  Stumble This Post&#160; ]]></description>
			<content:encoded><![CDATA[<p>9yrzi3pm5k</p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fforexdecode.com%2F9yrzi3pm5k%2F', '9yrzi3pm5k')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fforexdecode.com%2F9yrzi3pm5k%2F', title: '+9yrzi3pm5k+' })"/></div><p align="left"><a class="tt" href="http://twitter.com/home/?status=9yrzi3pm5k+http://s9qdc.th8.us" title="Post to Twitter"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a class="tt" href="http://twitter.com/home/?status=9yrzi3pm5k+http://s9qdc.th8.us" title="Post to Twitter">Tweet This Post</a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/9yrzi3pm5k/&amp;title=9yrzi3pm5k" title="Post to Delicious"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-delicious-big1.png" alt="[Post to Delicious]" border="0" /></a> <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/9yrzi3pm5k/&amp;title=9yrzi3pm5k" title="Post to Delicious">Delicious This Post</a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=9yrzi3pm5k&amp;link=http://forexdecode.com/9yrzi3pm5k/" title="Post to Ping.fm"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-ping-big1.png" alt="[Post to Ping.fm]" border="0" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=9yrzi3pm5k&amp;link=http://forexdecode.com/9yrzi3pm5k/" title="Post to Ping.fm">Ping This Post</a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/9yrzi3pm5k/&amp;title=9yrzi3pm5k" title="Post to StumbleUpon"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-su-big1.png" alt="[Post to StumbleUpon]" border="0" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/9yrzi3pm5k/&amp;title=9yrzi3pm5k" title="Post to StumbleUpon">Stumble This Post</a>&nbsp; </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/forexdecode?a=66ySvRSHohQ:mrIQe7KdHrQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=66ySvRSHohQ:mrIQe7KdHrQ:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=66ySvRSHohQ:mrIQe7KdHrQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=66ySvRSHohQ:mrIQe7KdHrQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=66ySvRSHohQ:mrIQe7KdHrQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=66ySvRSHohQ:mrIQe7KdHrQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=66ySvRSHohQ:mrIQe7KdHrQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=66ySvRSHohQ:mrIQe7KdHrQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=66ySvRSHohQ:mrIQe7KdHrQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=66ySvRSHohQ:mrIQe7KdHrQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=66ySvRSHohQ:mrIQe7KdHrQ:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/forexdecode/~4/66ySvRSHohQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forexdecode.com/9yrzi3pm5k/feed/</wfw:commentRss>
		<feedburner:origLink>http://forexdecode.com/9yrzi3pm5k/</feedburner:origLink></item>
		<item>
		<title>ZZ SR TL Indicator.mq4</title>
		<link>http://feedproxy.google.com/~r/forexdecode/~3/9j4-H5K1StI/</link>
		<comments>http://forexdecode.com/zz-sr-tl-indicatormq4/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 17:13:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Metatrader Indicator Code]]></category>

		<category><![CDATA[Z]]></category>

		<category><![CDATA[ZZ SR TL Indicator.mq4]]></category>

		<guid isPermaLink="false">http://forexdecode.com/?p=1001</guid>
		<description><![CDATA[//+------------------------------------------------------------------+
//&#124;                                             SUPRESMultiFrame.mq4 &#124;
//&#124;         [...]]]></description>
			<content:encoded><![CDATA[<pre>//+------------------------------------------------------------------+
//|                                             SUPRESMultiFrame.mq4 |
//|                                                                  |
//|                                                            RD    |
//+------------------------------------------------------------------+
#property copyright "RD"
#property link      "marynarz15@wp.pl"
#property indicator_chart_window
#define MaxObject    1000
//---- indicator parameters
extern int TimeFrame=15; TimeFrame=Period();
extern int BarsMax=144;
extern int ExtDepth=12;
extern int ExtDeviation=1;
extern int ExtBackstep=5;
bool DeleteObjectsOnExit=true;
color LineColor1=Black;
color LineColor5=Black;
color LineColor15=Black;
color LineColor30=Black;
color LineColor60=Black;
color LineColor240=Orange;
color LineColor1440=Black;
color LineColor10080=Black;
//-----------------------
double ExtMapBuffer[];
double ExtMapBuffer2[];
int SUPRESCount=0;
int linewidth;
string NamePattern;
color LineColor;

//+------------------------------------------------------------------+
//|                           Delete objects                         |
//+------------------------------------------------------------------+
int DeleteSupRes()
   {
      int ObjectCount=ObjectsTotal();
      string names[MaxObject];
      for (int i=0; i&lt;ObjectCount;i++)
         names[i]=ObjectName(i);
      for (i=0; i&lt;ObjectCount;i++)
      {
         string objname=names[i];
         objname=StringSubstr(objname,0,StringLen(NamePattern));
         if (objname!=NamePattern || ObjectType(names[i])!=OBJ_TREND)
               names[i]="";
      }
      for (i=0; i&lt;ObjectCount;i++)
      {
         if (names[i]!="") {
         ObjectDelete(names[i]);}
      }
      return(0);
   }

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
   SetIndexBuffer(0,ExtMapBuffer);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(0,0.0);
   ArraySetAsSeries(ExtMapBuffer,true);
   ArraySetAsSeries(ExtMapBuffer2,true);
   switch (TimeFrame)
     {
        case 1: linewidth=1; LineColor=LineColor1; break;
        case 5: linewidth=1; LineColor=LineColor5; break;
        case 15: linewidth=1; LineColor=LineColor15; break;
        case 30: linewidth=1; LineColor=LineColor30; break;
        case 60: linewidth=1; LineColor=LineColor60; break;
        case 240: linewidth=1; LineColor=LineColor240; break;
        case 1440: linewidth=1; LineColor=LineColor1440; break;
        case 10080: linewidth=1; LineColor=LineColor10080; break;
        default: linewidth=1; TimeFrame=Period(); break;
     }
   NamePattern=DoubleToStr(TimeFrame,0)+" SUPRES ";
   if (BarsMax&lt;55) BarsMax=55;

   DeleteSupRes();
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
      if (DeleteObjectsOnExit) DeleteSupRes();
      return(0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    shift, back,lasthighpos,lastlowpos;
   double val,res;
   double curlow,curhigh,lasthigh,lastlow;
   string objectname;

   if(BarsMax==0) {BarsMax=Bars/2;}// return(0);
   for(shift=iBars(NULL,TimeFrame)-ExtDepth; shift&gt;=0; shift--)
     {
      val=iLow(NULL,TimeFrame,Lowest(NULL,TimeFrame,MODE_LOW,ExtDepth,shift));
      if(val==lastlow) val=0.0;
      else
        {
         lastlow=val;
         if((iLow(NULL,TimeFrame,shift)-val)&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer[shift+back];
               if((res!=0)&amp;&amp;(res&gt;val)) ExtMapBuffer[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer[shift]=val;
      //--- high
      val=iHigh(NULL,TimeFrame,Highest(NULL,TimeFrame,MODE_HIGH,ExtDepth,shift));
      if(val==lasthigh) val=0.0;
      else
        {
         lasthigh=val;
         if((val-iHigh(NULL,TimeFrame,shift))&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer2[shift+back];
               if((res!=0)&amp;&amp;(res&lt;val)) ExtMapBuffer2[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer2[shift]=val;
     }

   // final cutting
   lasthigh=-1; lasthighpos=-1;
   lastlow=-1;  lastlowpos=-1;

   for(shift=iBars(NULL,TimeFrame)-ExtDepth; shift&gt;=0; shift--)
     {
      curlow=ExtMapBuffer[shift];
      curhigh=ExtMapBuffer2[shift];
      if((curlow==0)&amp;&amp;(curhigh==0)) continue;
      //---
      if(curhigh!=0)
        {
         if(lasthigh&gt;0)
           {
            if(lasthigh&lt;curhigh) ExtMapBuffer2[lasthighpos]=0;
            else ExtMapBuffer2[shift]=0;
           }
         //---
         if(lasthigh&lt;curhigh || lasthigh&lt;0)
           {
            lasthigh=curhigh;
            lasthighpos=shift;
           }
         lastlow=-1;
        }
      //----
      if(curlow!=0)
        {
         if(lastlow&gt;0)
           {
            if(lastlow&gt;curlow) ExtMapBuffer[lastlowpos]=0;
            else ExtMapBuffer[shift]=0;
           }
         //---
         if((curlow&lt;lastlow)||(lastlow&lt;0))
           {
            lastlow=curlow;
            lastlowpos=shift;
           }
         lasthigh=-1;
        }
     }

   for(shift=iBars(NULL,TimeFrame)-1; shift&gt;=0; shift--)
     {
      if(shift&gt;=iBars(NULL,TimeFrame)-ExtDepth) ExtMapBuffer[shift]=0.0;
      else
        {
         res=ExtMapBuffer2[shift];
         if(res!=0.0) ExtMapBuffer[shift]=res;
        }
     }
 ///////////////////////// Lines creation /////////////////
   int count=0;
   double TempBufferPrice[MaxObject];
   int TempBufferBar[MaxObject];
   string ObjectNames[MaxObject];
 //////////////////////// lists of lines //////////////////
   for(shift=BarsMax; shift&gt;0; shift--)
       if (ExtMapBuffer[shift]&gt;0)
         {
            count++;
            TempBufferPrice[count-1]=ExtMapBuffer[shift];
            TempBufferBar[count-1]=shift;
         }
   for(int i=0; i&lt;count; i++)
         ObjectNames[i]=/*TimeFrame+"m S/R("+i+")"+DoubleToStr(TempBufferPrice[i],Digits)+" "+*/
                        TimeToStr(iTime(NULL,TimeFrame,TempBufferBar[i]),TIME_DATE|TIME_MINUTES);

 /////// deleting pending objects ///////////////
   int ObjectForDeleteCount=0;
   string ObjectsForDelete[MaxObject];
   for(i=0; i&lt;ObjectsTotal(); i++)
      {
         objectname=ObjectName(i);
         if (StringSubstr(objectname,0,StringLen(NamePattern))==NamePattern)
            {
               ObjectForDeleteCount++;
               ObjectsForDelete[ObjectForDeleteCount-1]=objectname;
            }
      }
   for(i=0; i&lt;count-2; i++)
      {
         objectname=ObjectNames[i];
            for(int j=0; j&lt;ObjectForDeleteCount; j++)
                 if(ObjectsForDelete[j]==objectname)
                  {
                      ObjectsForDelete[j]="";
                      break;
                  }
      }
   for(j=0; j&lt;ObjectForDeleteCount; j++)
      if (ObjectsForDelete[j]!="")
      {
         ObjectDelete(ObjectsForDelete[j]);
      }
 ////////////// objects plotting /////////////////
   for(i=0; i&lt;count; i++)
      {
         if (ObjectFind(ObjectNames[i])==-1)
            {
                ObjectCreate(ObjectNames[i],OBJ_TREND,0,iTime(NULL,TimeFrame,TempBufferBar[i]),TempBufferPrice[i],
                                 iTime(NULL,TimeFrame,TempBufferBar[i])+10080*60,TempBufferPrice[i]);
                ObjectSet(ObjectNames[i],OBJPROP_WIDTH,linewidth);
                ObjectSet(ObjectNames[i],OBJPROP_COLOR,LineColor);
                ObjectSet(ObjectNames[i],OBJPROP_RAY,True);
                ObjectSetText(ObjectNames[i],ObjectNames[i]/*+" "+DoubleToStr(TempBufferPrice[i],Digits),8,"Courier",LightSteelBlue*/);
            }
      }
}</pre>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fforexdecode.com%2Fzz-sr-tl-indicatormq4%2F', 'ZZ+SR+TL+Indicator.mq4')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fforexdecode.com%2Fzz-sr-tl-indicatormq4%2F', title: '+ZZ+SR+TL+Indicator.mq4+' })"/></div><p align="left"><a class="tt" href="http://twitter.com/home/?status=ZZ+SR+TL+Indicator.mq4+http://tpamm.th8.us" title="Post to Twitter"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a class="tt" href="http://twitter.com/home/?status=ZZ+SR+TL+Indicator.mq4+http://tpamm.th8.us" title="Post to Twitter">Tweet This Post</a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zz-sr-tl-indicatormq4/&amp;title=ZZ+SR+TL+Indicator.mq4" title="Post to Delicious"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-delicious-big1.png" alt="[Post to Delicious]" border="0" /></a> <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zz-sr-tl-indicatormq4/&amp;title=ZZ+SR+TL+Indicator.mq4" title="Post to Delicious">Delicious This Post</a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZZ+SR+TL+Indicator.mq4&amp;link=http://forexdecode.com/zz-sr-tl-indicatormq4/" title="Post to Ping.fm"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-ping-big1.png" alt="[Post to Ping.fm]" border="0" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZZ+SR+TL+Indicator.mq4&amp;link=http://forexdecode.com/zz-sr-tl-indicatormq4/" title="Post to Ping.fm">Ping This Post</a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zz-sr-tl-indicatormq4/&amp;title=ZZ+SR+TL+Indicator.mq4" title="Post to StumbleUpon"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-su-big1.png" alt="[Post to StumbleUpon]" border="0" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zz-sr-tl-indicatormq4/&amp;title=ZZ+SR+TL+Indicator.mq4" title="Post to StumbleUpon">Stumble This Post</a>&nbsp; </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/forexdecode?a=9j4-H5K1StI:3OPHxjmUvug:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=9j4-H5K1StI:3OPHxjmUvug:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=9j4-H5K1StI:3OPHxjmUvug:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=9j4-H5K1StI:3OPHxjmUvug:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=9j4-H5K1StI:3OPHxjmUvug:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=9j4-H5K1StI:3OPHxjmUvug:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=9j4-H5K1StI:3OPHxjmUvug:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=9j4-H5K1StI:3OPHxjmUvug:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=9j4-H5K1StI:3OPHxjmUvug:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=9j4-H5K1StI:3OPHxjmUvug:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=9j4-H5K1StI:3OPHxjmUvug:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/forexdecode/~4/9j4-H5K1StI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forexdecode.com/zz-sr-tl-indicatormq4/feed/</wfw:commentRss>
		<feedburner:origLink>http://forexdecode.com/zz-sr-tl-indicatormq4/</feedburner:origLink></item>
		<item>
		<title>ZZ MTF XO A.mq4</title>
		<link>http://feedproxy.google.com/~r/forexdecode/~3/laaVKN8ZS5I/</link>
		<comments>http://forexdecode.com/zz-mtf-xo-amq4/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 17:11:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Metatrader Indicator Code]]></category>

		<category><![CDATA[Z]]></category>

		<category><![CDATA[ZZ MTF XO A.mq4]]></category>

		<guid isPermaLink="false">http://forexdecode.com/?p=1000</guid>
		<description><![CDATA[//+------------------------------------------------------------------+
//&#124;                                                  ZZ MTF XO A.mq4 &#124;
//&#124; [...]]]></description>
			<content:encoded><![CDATA[<pre>//+------------------------------------------------------------------+
//|                                                  ZZ MTF XO A.mq4 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright " ZZ MTF XO A "
#property link      " ZZ MTF XO A "

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 LimeGreen
#property indicator_color2 Red

#property indicator_maximum 1
#property indicator_minimum -1

extern int TimeFrame=0;
extern double KirPER=10;                            //10
//---- input parameters
/*************************************************************************
PERIOD_M1   1
PERIOD_M5   5
PERIOD_M15  15
PERIOD_M30  30
PERIOD_H1   60
PERIOD_H4   240
PERIOD_D1   1440
PERIOD_W1   10080
PERIOD_MN1  43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
**************************************************************************/
//---- buffers

double ExtMapBuffer1[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,2);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,2);
   SetIndexBuffer(1,ExtMapBuffer2);

//---- 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";
   }
   string short_name;
   short_name=("XO A("+TimeFrame+","+KirPER+")");
    IndicatorShortName(short_name);
     SetIndexLabel(0,short_name);
  }
//----
   return(0);

//+------------------------------------------------------------------+
//| MTF Parabolic Sar                                         |
//+------------------------------------------------------------------+
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;
   limit=Bars-counted_bars;
   for(i=0,y=0;i&lt;limit;i++)
   {
   if (Time[i]&lt;TimeArray[y]) y++;

/***********************************************************
   Add your main indicator loop below.  You can reference an existing
      indicator with its iName  or iCustom.
   Rule 1:  Add extern inputs above for all neccesary values
   Rule 2:  Use 'TimeFrame' for the indicator time frame
   Rule 3:  Use 'y' for your indicator's shift value
 **********************************************************/

   ExtMapBuffer1[i]=iCustom(NULL,TimeFrame,"XO",KirPER,0,y);
   ExtMapBuffer2[i]=iCustom(NULL,TimeFrame,"XO",KirPER,1,y);

   }
   return(0);
  }
//+------------------------------------------------------------------+</pre>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fforexdecode.com%2Fzz-mtf-xo-amq4%2F', 'ZZ+MTF+XO+A.mq4')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fforexdecode.com%2Fzz-mtf-xo-amq4%2F', title: '+ZZ+MTF+XO+A.mq4+' })"/></div><p align="left"><a class="tt" href="http://twitter.com/home/?status=ZZ+MTF+XO+A.mq4+http://63i3b.th8.us" title="Post to Twitter"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a class="tt" href="http://twitter.com/home/?status=ZZ+MTF+XO+A.mq4+http://63i3b.th8.us" title="Post to Twitter">Tweet This Post</a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zz-mtf-xo-amq4/&amp;title=ZZ+MTF+XO+A.mq4" title="Post to Delicious"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-delicious-big1.png" alt="[Post to Delicious]" border="0" /></a> <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zz-mtf-xo-amq4/&amp;title=ZZ+MTF+XO+A.mq4" title="Post to Delicious">Delicious This Post</a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZZ+MTF+XO+A.mq4&amp;link=http://forexdecode.com/zz-mtf-xo-amq4/" title="Post to Ping.fm"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-ping-big1.png" alt="[Post to Ping.fm]" border="0" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZZ+MTF+XO+A.mq4&amp;link=http://forexdecode.com/zz-mtf-xo-amq4/" title="Post to Ping.fm">Ping This Post</a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zz-mtf-xo-amq4/&amp;title=ZZ+MTF+XO+A.mq4" title="Post to StumbleUpon"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-su-big1.png" alt="[Post to StumbleUpon]" border="0" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zz-mtf-xo-amq4/&amp;title=ZZ+MTF+XO+A.mq4" title="Post to StumbleUpon">Stumble This Post</a>&nbsp; </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/forexdecode?a=laaVKN8ZS5I:nVusPAwNsRs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=laaVKN8ZS5I:nVusPAwNsRs:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=laaVKN8ZS5I:nVusPAwNsRs:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=laaVKN8ZS5I:nVusPAwNsRs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=laaVKN8ZS5I:nVusPAwNsRs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=laaVKN8ZS5I:nVusPAwNsRs:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=laaVKN8ZS5I:nVusPAwNsRs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=laaVKN8ZS5I:nVusPAwNsRs:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=laaVKN8ZS5I:nVusPAwNsRs:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=laaVKN8ZS5I:nVusPAwNsRs:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=laaVKN8ZS5I:nVusPAwNsRs:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/forexdecode/~4/laaVKN8ZS5I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forexdecode.com/zz-mtf-xo-amq4/feed/</wfw:commentRss>
		<feedburner:origLink>http://forexdecode.com/zz-mtf-xo-amq4/</feedburner:origLink></item>
		<item>
		<title>ZUP_v39.mq4</title>
		<link>http://feedproxy.google.com/~r/forexdecode/~3/WIZ2OPUPW8w/</link>
		<comments>http://forexdecode.com/zup_v39mq4/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 17:09:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Metatrader Indicator Code]]></category>

		<category><![CDATA[Z]]></category>

		<category><![CDATA[ZUP_v39.mq4]]></category>

		<guid isPermaLink="false">http://forexdecode.com/?p=999</guid>
		<description><![CDATA[
 Tweet This Post&#160;  Delicious This Post&#160;  Ping This Post&#160;  Stumble This Post&#160; ]]></description>
			<content:encoded><![CDATA[
 Tweet This Post&#160;  Delicious This Post&#160;  Ping This Post&#160;  Stumble This Post&#160; <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/forexdecode?a=WIZ2OPUPW8w:Hor0NzsF36A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=WIZ2OPUPW8w:Hor0NzsF36A:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=WIZ2OPUPW8w:Hor0NzsF36A:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=WIZ2OPUPW8w:Hor0NzsF36A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=WIZ2OPUPW8w:Hor0NzsF36A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=WIZ2OPUPW8w:Hor0NzsF36A:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=WIZ2OPUPW8w:Hor0NzsF36A:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=WIZ2OPUPW8w:Hor0NzsF36A:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=WIZ2OPUPW8w:Hor0NzsF36A:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=WIZ2OPUPW8w:Hor0NzsF36A:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=WIZ2OPUPW8w:Hor0NzsF36A:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/forexdecode/~4/WIZ2OPUPW8w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forexdecode.com/zup_v39mq4/feed/</wfw:commentRss>
		<feedburner:origLink>http://forexdecode.com/zup_v39mq4/</feedburner:origLink></item>
		<item>
		<title>ZUP_v14.mq4</title>
		<link>http://feedproxy.google.com/~r/forexdecode/~3/IgUOwZNYaS8/</link>
		<comments>http://forexdecode.com/zup_v14mq4/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 16:55:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Metatrader Indicator Code]]></category>

		<category><![CDATA[Z]]></category>

		<category><![CDATA[ZUP_v14.mq4]]></category>

		<guid isPermaLink="false">http://forexdecode.com/?p=998</guid>
		<description><![CDATA[//compile//
//+----------------------------------------------------------------------+
//&#124;ZigZag ???? ?????                                            &#124;
//&#124;----------------------------------------------------------------------+
//&#124;         [...]]]></description>
			<content:encoded><![CDATA[<pre>//compile//
//+----------------------------------------------------------------------+
//|ZigZag ???? ?????                                            |
//|----------------------------------------------------------------------+
//|                                                                      |
//|ExtIndicator - ??????? ?????, ? ??? ????          |
//|               ????? ???? ?????                           |
//|           0 - Zigzag ? ??????,                                |
//|           1 - Zigzag ???,                                         |
//|           2 - ????????? ???????Ensign                |
//|                                                                      |
//|minBars - ??? ????(???? ????? ???                  |
//|minSize - ??? ? ????? ????(???? ????? ????  |
//|                                                                      |
//|minPercent - ????? ??? (???? ???? ???? 0.5)       |
//|             ?? ?????? ???? - ??????? ?minSize=0;  |
//|                                                                      |
//|                                                                      |
//|ExtHidden - 0 - ????????. ????ZigZag.                     |
//|            1 - ????? ?????????????, ?????     |
//|                ??????????? &gt;0.21 ?&lt;5.                    |
//|            2 - ????? ??? ?  ??? ??????????-    |
//|                ??? ?????? ?????(?0.866 ?? ???-    |
//|                ?? ?????Gartley)                               |
//|            3 - ????? ??? ??????????? 2            |
//|                ????????????                              |
//|            4 - ????? ???? ?????????????????|
//|                                                                      |
//|                                                                      |
//|ExtFractal - ????? ?????(?????, ?????,            |
//|             ? ?????? ??????? ?????                |
//|                                                                      |
//|ExtFractalEnd - ????? ????? ??????? ???           |
//|                ??? ??????? ?????? ???? ???     |
//|                ?? ExtFractalEnd=0 ? ????????????      |
//|                ???????????????                        |
//|                ?????????? ExtFractalEnd=5                  |
//|                                                                      |
//|ExtDelta - (???) ????? ????? ??? ????             |
//|           ???????????????.                            |
//|                  ??? ?? 0&lt;ExtDelta&lt;1                            |
//|                                                                      |
//|ExtDeltaType -    0 - ????? ???? ??????? "????"    |
//|                  1 - ??? ????(%-????????&lt;ExtDelta     |
//|                  2 - ((%-????????/????????&lt;ExtDelta  |
//|                                                                      |
//|chHL     = true     - ?? ??? ????? ??? ???????     |
//|PeakDet  = true     - ?? ??? ????? ??? ?????        |
//|                                                                      |
//|ExtFiboDinamic - ????????????????????.            |
//|                 ?????? ??? ?? ????? ? ??? ??    |
//|                 ZigZag-a.                                            |
//|                                                                      |
//|ExtFiboStatic - ????????????????????              |
//|                                                                      |
//|ExtFiboStaticNum - ????? ZigZag-a, ? ???? ????????  |
//|                   ????????? ????? 1&lt;ExtFiboStaticNum&lt;9 |
//|                                                                      |
//|ExtSizeTxt - ??? ??? ?? ??? ???                          |
//|                                                                      |
//|ExtLine - ????????????? ???                           |
//|                                                                      |
//|ExtPesavento - ??????????????                           |
//|                                                                      |
//|ExtGartley866 - ?????????.866                                |
//|                                                                      |
//|ExtNotFibo - ???????? ????????                        |
//|                                                                      |
//|ExtFiboS ?ExtFiboD - ??????????????????? ??     |
//|                                                                      |
//|ExtDeleteObj = true - ????? ??????? ???? ??         |
//|               ??????????????????.                  |
//|                                                                      |
//|ExtDeviation ?ExtBackstep - ?????????? ? ZigZag ? MT4    |
//|                                                                      |
//+----------------------------------------------------------------------+
#property copyright "nen"
#property link      "http://onix-trade.net/forum/index.php?s=&amp;showtopic=118&amp;view=findpost&amp;p=46508"

#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_color3 Orange
#property indicator_color4 LightSkyBlue
#property indicator_color5 LemonChiffon
//---- indicator parameters
extern int ExtIndicator=2;
extern int minBars=12;
extern int minSize = 15;
extern double minPercent = 0;
extern int ExtHidden=1;
extern int ExtFractal=8;
extern int ExtFractalEnd=8;
extern double ExtDelta=0.04;
extern int ExtDeltaType=2;
extern bool chHL = false;
extern bool PeakDet = false;
//-------------------------------------
extern bool ExtFiboDinamic=false;
extern bool ExtFiboStatic=false;
extern int ExtFiboStaticNum=2;
extern int ExtSizeTxt=7;
extern color ExtLine=DarkBlue;
extern color ExtNotFibo=SlateGray;
extern color ExtPesavento=Yellow;
extern color ExtGartley866=GreenYellow;
extern color ExtFiboS=Teal;
extern color ExtFiboD=Sienna;
// ????? ? ZigZag ? ?
extern bool ExtDeleteObj=false;
extern int ExtDeviation=5;
extern int ExtBackstep=3;

// ?????? ZigZag
// ??? ?? ?????ZigZag
double zz[];
// ??? ?????ZigZag
double zzL[];
// ??? ????? ZigZag
double zzH[];

// ????? ?? ?????
// ??? ????????(?? ????????? ??)
double fi[]={0.382, 0.5, 0.618, 0.707, 0.786, 0.841, 0.886, 1.0, 1.128, 1.272, 1.414, 1.5, 1.618, 2.0, 2.414, 2.618, 4.0};
string fitxt[]={ ".382", ".5", ".618", ".707", ".786", ".841", ".886", "1.0", "1.128", "1.272", "1.414", "1.5", "1.618", "2.0", "2.414", "2.618", "4.0" };
string nameObj,nameObjtxt;
// ?????? ??? ?????????afr - ??? ???? ?????? ?????????????????????? ?????????
// afrl - ????, afrh - ?????
int afr[]={0,0,0,0,0,0,0,0,0,0};
double afrl[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}, afrh[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
bool afrm=true;
double HL,HLp,kk,kj,Angle;
// LowPrim,HighPrim,LowLast,HighLast - ???? ??????????? ???
double LowPrim,HighPrim,LowLast,HighLast;
// numLowPrim,numHighPrim,numLowLast,numHighLast -??? ???
int numLowPrim,numHighPrim,numLowLast,numHighLast,k,k1,k2,ki,countLow1,countHigh1,shift,shift1;
// ??? ??????? ? ???? ?? ?????
int timeFr1new;
// ?????????
int countFr;
// ?? ? ???? ?? ???? ??????? ???? ???? ??
int countBarEnd=0,TimeBarEnd;
// ?? ? ???? ?? ???????? ???? ??
int numBar=0;
// ???????
int numOb;
// flagFrNew=true - ?????? ???????????? ????????? ? ??? ?? =false - ? ?????
bool flagFrNew=false;
// ??? ???? ????
int perTF;

int counted_bars;

// ????? ?? ZigZag ??? ?????? ????????????Ensign
double ha[],la[],hi,li,si,sip,di,hm,lm,ham[],lam[],him,lim,LastBar0,lLast=0,hLast=0;
int fs,fsp,countBar;
int ai,aip,bi,bip,ai0,aip0,bi0,bip0,Last_Bar,last0;
datetime tai,tbi,taip,tbip,ti,ts0=0,t0=0,taiLast,tbiLast;
bool fh=false,fl=false;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(7);
//---- drawing settings
// ZigZag
   SetIndexStyle(0,DRAW_SECTION);
   SetIndexBuffer(0,zz);
   SetIndexBuffer(5,zzL);
   SetIndexBuffer(6,zzH);
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
   SetIndexEmptyValue(2,0.0);
   SetIndexEmptyValue(3,0.0);
   SetIndexEmptyValue(4,0.0);
   SetIndexEmptyValue(5,0.0);
   SetIndexEmptyValue(6,0.0);
//   ArraySetAsSeries(zz,true);
//   ArraySetAsSeries(zzL,true);
//   ArraySetAsSeries(zzH,true);
// ??? ????? ???
   SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
   SetIndexStyle(2,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(1,ham);
   SetIndexBuffer(2,lam);
// ??? ???????
   SetIndexStyle(3,DRAW_LINE,STYLE_DOT);
   SetIndexStyle(4,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(3,ha);
   SetIndexBuffer(4,la);
   if (ExtIndicator==1) if (minSize!=0) di=minSize*Point/2;
   if (ExtIndicator==2)
     {
      if (minSize!=0) {di=minSize*Point; countBar=minBars;}
     }
// ???? ?????? ??????????????
   if (ExtDelta&lt;=0) ExtDelta=0.001;
   if (ExtDelta&gt;1) ExtDelta=0.999;

   if (ExtHidden&lt;0) ExtHidden=0;
   if (ExtHidden&gt;4) ExtHidden=4;

   if (ExtDeltaType&lt;0) ExtDeltaType=0;
   if (ExtDeltaType&gt;3) ExtDeltaType=3;

   if (ExtFractalEnd&gt;0)
     {
      if (ExtFractalEnd&lt;5) ExtFractalEnd=5;
     }
   if (ExtFiboStaticNum&lt;2) ExtFiboStaticNum=2;
   if (ExtFiboStaticNum&gt;9) ExtFiboStaticNum=9;

   perTF=Period();

   return(0);
  }
//+------------------------------------------------------------------+
//| ????????. ???? ?? ??????????????????
//+------------------------------------------------------------------+
int deinit()
  {
   if (ExtDeleteObj) {ObjectsDeleteAll(0,2); ObjectsDeleteAll(0,21);}
   else delete_objects1();

   ObjectDelete("fiboS");ObjectDelete("fiboD"); return(0);
  }
//********************************************************
// ???
int start()
  {
   counted_bars=IndicatorCounted();

   if( counted_bars&lt;0 )
   {
      Alert("?? ?????????");
      return(-1);
   }

//-----------------------------------------
//
//     1.
//
// ?? ????? ????
// zz[] - ??? ??? ? ???? ???? ?? ???????? ZigZag-a
// zzL[] - ??? ?????????
// zzH[] - ??? ????? ????
// ???.
//-----------------------------------------
//
// ?? ??????? ????????,
// ????????? ?????????? ???.
// ????????????? ? ??? ???,
// ????? ? ?????????
//
// ???? ?? ????????????? ?????
//
//-----------------------------------------

if (perTF!=Period())
  {
   delete_objects1();
   perTF=Period();
  }

if (ExtIndicator==0) ZigZag_();
if (ExtIndicator==1) ang_AZZ_();
if (ExtIndicator==2) Ensign_ZZ();
//-----------------------------------------
// ?? ????? ???? ???
//-----------------------------------------

if (ExtHidden&gt;0) // ????? ? ???????. ???.
  {
//======================
//======================
//======================

//-----------------------------------------
//
//     2.
//
// ?? ????? ???. ???.
//-----------------------------------------

   if (Bars - counted_bars&gt;2 || flagFrNew)
     {

      // ??????????? ??, ? ???? ???????? ??????? ???
      if (countBarEnd==0)
        {
         if (ExtFractalEnd&gt;0)
           {
            k=ExtFractalEnd;
            for (shift=0; shift&lt;Bars &amp;&amp; k&gt;0; shift++)
              {
               if (zz[shift]&gt;0 &amp;&amp; zzH[shift]&gt;0) {countBarEnd=shift; TimeBarEnd=Time[shift]; k--;}
              }
           }
         else
           {
            countBarEnd=Bars-3;
            TimeBarEnd=Time[Bars-3];
           }
        }
      else
        {
         countBarEnd=iBarShift(Symbol(),Period(),TimeBarEnd);
        }

      // ??????? ????
      matriza();
     }
//-----------------------------------------
// ?? ????? ???. ???
//-----------------------------------------

//-----------------------------------------
//
//     3.
//
// ?? ???? ????? ???
// ????? ??????. ???.
//-----------------------------------------
// ????? ?????? ??????? ???.

if (Bars - counted_bars&lt;3)
  {
   // ????????? ????????, ??? ? ???? ??
   for (shift1=0; shift1&lt;Bars; shift1++)
     {
      if (zz[shift1]&gt;0.0 &amp;&amp; (zzH[shift1]==zz[shift1] || zzL[shift1]==zz[shift1]))
       {
        timeFr1new=Time[shift1];
        break;
       }
     }
   // ?????, ? ??????? ?????????
   shift=iBarShift(Symbol(),Period(),afr[0]);

   // ????????? ???? ???? ??? ?????????

   // ?????? ???????
   if (timeFr1new!=afr[0])
     {
      flagFrNew=true;
      if (shift&gt;=shift1) numBar=shift; else  numBar=shift1;
      afrm=true;
     }

   // ????? ?????????? ? ??? ??
   if (afrh[0]&gt;0 &amp;&amp; zz[shift]==0.0)
     {
      flagFrNew=true;
      if (numBar&lt;shift) numBar=shift;
      afrm=true;
     }
   // ????? ???? ????? ? ??? ??
   if (afrl[0]&gt;0 &amp;&amp; zz[shift]==0.0)
     {
      flagFrNew=true;
      if (numBar&lt;shift) numBar=shift;
      afrm=true;
     }

//-----------3 ????? ???? ?????? ? ???? ? ??? ??. ???.

//============= 1 ????? ????. ???.
if (afrh[0]-High[shift]!=0 &amp;&amp; afrh[0]&gt;0)
  {

   numLowPrim=0; numLowLast=0;
   numHighPrim=shift; numHighLast=0;

   LowPrim=0.0; LowLast=0.0;
   HighPrim=High[shift]; HighLast=0.0;

   Angle=-100;

   for (k=shift+1; k&lt;=countBarEnd; k++)
     {

      if (zzL[k]&gt;0.0 &amp;&amp; LowPrim==0.0 &amp;&amp; zzL[k]==zz[k]) {LowPrim=zzL[k]; numLowPrim=k;}
      if (zzL[k]&gt;0.0 &amp;&amp; zzL[k]&lt;LowPrim &amp;&amp; zzL[k]==zz[k]) {LowPrim=zzL[k]; numLowPrim=k;}
      if (zzH[k]&gt;0.0  &amp;&amp; zzH[k]==zz[k])
        {
         if (HighLast&gt;0)
           {
            HighLast=High[k]; numHighLast=k;
           }
         else {numHighLast=k; HighLast=High[k];}

         HL=High[numHighLast]-Low[numLowPrim];
         kj=(HighPrim-HighLast)*1000/(numHighLast-numHighPrim);
         if (HL&gt;0 &amp;&amp; (Angle&gt;kj || Angle==-100))  // ???? ?? ???????
           {
            Angle=kj;
// ???? ???
            HLp=High[numHighPrim]-Low[numLowPrim];
            k1=MathCeil((shift+numHighLast)/2);
            kj=HLp/HL;
// ?????? ??????? ???

            nameObj="ph" + Time[numHighPrim] + "_" + Time[numHighLast];
            nameObjtxt="phtxt" + Time[numHighPrim] + "_" + Time[numHighLast];

            numOb=ObjectFind(nameObj);

            if (numOb&gt;-1)
              {
               if (kj&gt;0.21 &amp;&amp; kj&lt;=5)
                 {
                  // ??????????
                  ObjectMove(nameObj,0,Time[numHighPrim],High[numHighPrim]);
                  ObjectMove(nameObjtxt,0,Time[k1],MathAbs((High[numHighPrim]+High[numHighLast])/2));

                  // ???? ????? ????(????????. % ??????? ?????????
                  kk=kj;
                  k2=1;

                  if (ExtDeltaType==2) for (ki=0;ki&lt;=16;ki++) {if (MathAbs((fi[ki]-kj)/fi[ki])&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}
                  if (ExtDeltaType==1) for (ki=0;ki&lt;=16;ki++) {if (MathAbs(fi[ki]-kj)&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}

                  if (k2&lt;0)

                    // ??????????? ????????
                    if (ExtHidden!=4)
                      {
                       if (kk==0.886)
                         ObjectSetText(nameObjtxt,fitxt[ki],ExtSizeTxt,"Arial", ExtGartley866);
                       else
                         ObjectSetText(nameObjtxt,fitxt[ki],ExtSizeTxt,"Arial",ExtPesavento);
                      }
                    else
                    // ??????????? (? ?????
                      if (ExtHidden==1 || ExtHidden==4)
                        ObjectSetText(nameObjtxt,""+DoubleToStr(kk,2),ExtSizeTxt,"Arial",ExtNotFibo);
                 }
               else
                 {
                  ObjectDelete(nameObj);
                  ObjectDelete(nameObjtxt);
                 }
              }
            else
              {
//******* ????? ?????? ?? ???????.
               if (kj&gt;0.21 &amp;&amp; kj&lt;=5)
                 {
                  // ???? ????? ????(????????. % ??????? ?????????
                  kk=kj;
                  k2=1;

                  if (ExtDeltaType==1) for (ki=0;ki&lt;=16;ki++) {if (MathAbs(fi[ki]-kj)&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}
                  if (ExtDeltaType==2) for (ki=0;ki&lt;=16;ki++) {if (MathAbs((fi[ki]-kj)/fi[ki])&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}

                  if (k2&lt;0)
                    // ??????????? ?????????0.866
                    {
                     if (ExtHidden!=4)
                       {
                        ObjectCreate(nameObjtxt,OBJ_TEXT,0,Time[k1],MathAbs((High[numHighPrim]+High[numHighLast])/2));
                        if (kk==0.886) // Gartley
                          ObjectSetText(nameObjtxt,fitxt[ki],ExtSizeTxt,"Arial", ExtGartley866);
                        else
                          ObjectSetText(nameObjtxt,fitxt[ki],ExtSizeTxt,"Arial",ExtPesavento);
                       }
                    }
                  else
                    // ??????????? (? ??????0.866)
                    {
                     if (ExtHidden==1 || ExtHidden==4)
                       {
                        ObjectCreate(nameObjtxt,OBJ_TEXT,0,Time[k1],MathAbs((High[numHighPrim]+High[numHighLast])/2));
                        ObjectSetText(nameObjtxt,""+DoubleToStr(kk,2),ExtSizeTxt,"Arial",ExtNotFibo);
                       }
                    }
                  if ((ExtHidden==2 &amp;&amp; k2&lt;0) || ExtHidden!=2)
                    {
                     ObjectCreate(nameObj,OBJ_TREND,0,Time[numHighPrim],High[numHighPrim],Time[numHighLast],High[numHighLast]);
                     ObjectSet(nameObj,OBJPROP_RAY,false);
                     ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DOT);
                     ObjectSet(nameObj,OBJPROP_COLOR,ExtLine);
                    }
                 }
//*******
               }
             }
        }
     }
     afrh[0]=High[shift];
     if (ExtFiboDinamic)
       {
        screenFiboD();
       }
   }
//============= 1 ????? ????. ???
//
//============= 1 ????? ???? ???.
if (afrl[0]-Low[shift]!=0 &amp;&amp; afrl[0]&gt;0)
  {

   numLowPrim=0; numLowLast=0;
   numHighPrim=shift; numHighLast=0;

   LowPrim=Low[shift]; LowLast=0.0;
   HighPrim=0.0; HighLast=0.0;

   Angle=-100;
   for (k=shift+1; k&lt;=countBarEnd; k++)
     {
      if (zzH[k]&gt;HighPrim) {HighPrim=High[k]; numHighPrim=k;}
      if (zzL[k]&gt;0.0 &amp;&amp; zzL[k]==zz[k])
        {
         if (LowLast&gt;0)
           {
            LowLast=Low[k]; numLowLast=k;
           }
         else {numLowLast=k; LowLast=Low[k];}

         HL=High[numHighPrim]-Low[numLowLast];
         kj=(LowPrim-LowLast)*1000/(numLowLast-numLowPrim);
         if (HL&gt;0 &amp;&amp; (Angle&lt;kj || Angle==-100))  // ???? ?? ???????
           {
            Angle=kj;

            HLp=High[numHighPrim]-Low[numLowPrim];
            k1=MathCeil((numLowPrim+numLowLast)/2);
            kj=HLp/HL;
// ?????? ??????? ???

            nameObj="pl" + Time[numLowPrim] + "_" + Time[numLowLast];
            nameObjtxt="pltxt" + Time[numLowPrim] + "_" + Time[numLowLast];

            numOb=ObjectFind(nameObj);
            if (numOb&gt;-1)
              {
               if (kj&gt;0.21 &amp;&amp; kj&lt;=5)
                 {
                  // ??????????
                  ObjectMove(nameObj,0,Time[numLowPrim],Low[numLowPrim]);
                  ObjectMove(nameObjtxt,0,Time[k1],MathAbs((Low[numLowPrim]+Low[numLowLast])/2));

                  // ???? ????? ????(????????. % ??????? ????????
                  kk=kj;
                  k2=1;

                  if (ExtDeltaType==2) for (ki=0;ki&lt;=16;ki++) {if (MathAbs((fi[ki]-kj)/fi[ki])&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}
                  if (ExtDeltaType==1) for (ki=0;ki&lt;=16;ki++) {if (MathAbs(fi[ki]-kj)&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}

                  if (k2&lt;0)
                  // ??????????? ?????????0.866
                    {
                     if (ExtHidden!=4)
                       {
                        if (kk==0.886) // Gartley
                          ObjectSetText(nameObjtxt,fitxt[ki],ExtSizeTxt,"Arial", ExtGartley866);
                        else
                          ObjectSetText(nameObjtxt,fitxt[ki],ExtSizeTxt,"Arial",ExtPesavento);
                       }
                    }
                  else
                    // ??????????? (? ??????0.866)
                    if (ExtHidden==1 || ExtHidden==4)
                      ObjectSetText(nameObjtxt,""+DoubleToStr(kk,2),ExtSizeTxt,"Arial",ExtNotFibo);
                 }
               else
                 {
                  ObjectDelete(nameObj);
                  ObjectDelete(nameObjtxt);
                 }
              }
            else
              {
//******* ????? ?????? ?? ???????.
               if (kj&gt;0.21 &amp;&amp; kj&lt;=5)
                 {
                  // ???? ????? ????(????????. % ??????? ????????
                  kk=kj;
                  k2=1;

                  if (ExtDeltaType==2) for (ki=0;ki&lt;=16;ki++) {if (MathAbs((fi[ki]-kj)/fi[ki])&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}
                  if (ExtDeltaType==1) for (ki=0;ki&lt;=16;ki++) {if (MathAbs(fi[ki]-kj)&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}

                  if (k2&lt;0)
                    // ??????????? ?????????0.866
                    {
                     if (ExtHidden!=4)
                       {
                        nameObj="pltxt" + Time[numLowPrim] + "_" + Time[numLowLast];

                        ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],MathAbs((Low[numLowPrim]+Low[numLowLast])/2));
                        if (kk==0.886) // Gartley
                          ObjectSetText(nameObj,fitxt[ki],ExtSizeTxt,"Arial", ExtGartley866);
                        else
                          ObjectSetText(nameObj,fitxt[ki],ExtSizeTxt,"Arial",ExtPesavento);
                       }
                    }
                  else
                    // ??????????? (? ??????0.866)
                    {
                     if (ExtHidden==1 || ExtHidden==4)
                       nameObj="pltxt" + Time[numLowPrim] + "_" + Time[numLowLast];

                       ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],MathAbs((Low[numLowPrim]+Low[numLowLast])/2));
                       ObjectSetText(nameObj,""+DoubleToStr(kk,2),ExtSizeTxt,"Arial",ExtNotFibo);
                    }
                  if ((ExtHidden==2 &amp;&amp; k2&lt;0) || ExtHidden!=2)
                    {
                     nameObj="pl" + Time[numLowPrim] + "_" + Time[numLowLast];

                     ObjectCreate(nameObj,OBJ_TREND,0,Time[numLowPrim],Low[numLowPrim],Time[numLowLast],Low[numLowLast]);
                     ObjectSet(nameObj,OBJPROP_RAY,false);
                     ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DOT);
                     ObjectSet(nameObj,OBJPROP_COLOR,ExtLine);
                    }
                 }
//*******
               }
            }
        }
     }
     afrl[0]=Low[shift];
     if (ExtFiboDinamic)
       {
        screenFiboD();
       }
   }
//============= 1 ????? ???? ???
//-----------3 ????? ???? ?????? ? ???? ? ??? ??. ???

   // ??????????????????? ??? ?????? ?? ????? ???.
   countBarEnd=iBarShift(Symbol(),Period(),TimeBarEnd);
   for (k=0; k&lt;5; k++)
     {

      // ???? ?????.
      if (afrh[k]&gt;0)
        {
         // ?????, ? ???????? ????
         shift=iBarShift(Symbol(),Period(),afr[k]);
         if (zz[shift]==0)
           {
            flagFrNew=true;
            if (shift&gt;numBar) numBar=shift;
            afrm=true;
            numHighPrim=shift; numHighLast=0;HighLast=0.0;
            for (k1=shift+1; k1&lt;=countBarEnd; k1++)
              {
               if (zzH[k1]&gt;0)
                 {
                  HighLast=High[k1]; numHighLast=k1;

                  nameObj="ph" + Time[numHighPrim] + "_" + Time[numHighLast];

                  numOb=ObjectFind(nameObj);
                  if (numOb&gt;-1)
                    {
                     ObjectDelete(nameObj);

                     nameObjtxt="phtxt" + Time[numHighPrim] + "_" + Time[numHighLast];

                     ObjectDelete(nameObjtxt);
                    }
                 }
              }

           }
        }

      // ???? ?????
      if (afrl[k]&gt;0)
        {
         // ?????, ? ???????? ????
         shift=iBarShift(Symbol(),Period(),afr[k]);
         if (zz[shift]==0)
           {
            flagFrNew=true;
            if (shift&gt;numBar) numBar=shift;

            afrm=true;
            numLowPrim=shift; numLowLast=0;LowLast=10000000;
            for (k1=shift+1; k1&lt;=countBarEnd; k1++)
              {
               if (zzL[k1]&gt;0)
                 {
                  LowLast=Low[k1]; numLowLast=k1;

                  nameObj="pl" + Time[numLowPrim] + "_" + Time[numLowLast];

                  numOb=ObjectFind(nameObj);
                  if (numOb&gt;-1)
                    {
                     ObjectDelete(nameObj);

                     nameObjtxt="pltxt" + Time[numLowPrim] + "_" + Time[numLowLast];

                     ObjectDelete(nameObjtxt);
                    }
                 }
              }
           }
        }

     }
   // ??????????????????? ??? ?????? ?? ????? ???

   // ????? ???? ???.
   matriza ();
   // ????? ???? ???

  }
// ????? ?????? ??????? ???
//-----------------------------------------
// ?? ???? ????? ???
// ????? ??????. ???
//-----------------------------------------

      // ????????? ????? ???.
      countFractal();
      // ????????? ????? ???

//-----------------------------------------
//
//     4.
//
// ?? ??? ??????? ??? ???.
//-----------------------------------------
if (Bars - counted_bars&gt;2)
  {
//-----------1 ??????????. ???.
//+--------------------------------------------------------------------------+
//| ????????? ?????????????0.866 ?? ????? ZigZag-a
//| ??????? ? ???? ??
//+--------------------------------------------------------------------------+

   numLowPrim=0; numLowLast=0;
   numHighPrim=0; numHighLast=0;

   LowPrim=0.0; LowLast=0.0;
   HighPrim=0.0; HighLast=0.0;

   Angle=-100;

   if (flagFrNew) countFr=1;
   else countFr=ExtFractal;

   for (k=0; (k&lt;Bars-1 &amp;&amp; countHigh1&gt;0 &amp;&amp; countFr&gt;0); k++)
     {
      if (zzL[k]&gt;0.0 &amp;&amp; LowPrim==0.0 &amp;&amp; HighPrim&gt;0 &amp;&amp; zzL[k]==zz[k]) {LowPrim=zzL[k]; numLowPrim=k;}
      if (zzL[k]&gt;0.0 &amp;&amp; zzL[k]&lt;LowPrim &amp;&amp; HighPrim&gt;0 &amp;&amp; zzL[k]==zz[k]) {LowPrim=zzL[k]; numLowPrim=k;}
      if (zzH[k]&gt;0.0 &amp;&amp; zzH[k]==zz[k])
        {
         if (HighPrim&gt;0)
           {
            if (HighLast&gt;0)
              {
               HighLast=High[k]; numHighLast=k;
              }
            else {numHighLast=k; HighLast=High[k];}

            HL=High[numHighLast]-Low[numLowPrim];
            kj=(HighPrim-HighLast)*10000/(numHighLast-numHighPrim);
            if (HL&gt;0 &amp;&amp; (Angle&gt;kj || Angle==-100))  // ???? ?? ???????
              {
               Angle=kj;
               // ???? ????????? ????
               HLp=High[numHighPrim]-Low[numLowPrim];
               k1=MathCeil((numHighPrim+numHighLast)/2);
               kj=HLp/HL;

               if (kj&gt;0.21 &amp;&amp; kj&lt;=5)
                 {
                  // ???? ????? ????(????????. % ??????? ?????????
                  kk=kj;
                  k2=1;

                  if (ExtDeltaType==2) for (ki=0;ki&lt;=16;ki++) {if (MathAbs((fi[ki]-kj)/fi[ki])&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}
                  if (ExtDeltaType==1) for (ki=0;ki&lt;=16;ki++) {if (MathAbs(fi[ki]-kj)&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}

                  if (k2&lt;0)
                    // ??????????? ?????????0.866
                    {
                    if (ExtHidden!=4)
                      {
                       nameObj="phtxt" + Time[numHighPrim] + "_" + Time[numHighLast];

                       ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],MathAbs((High[numHighPrim]+High[numHighLast])/2));
                       if (kk==0.886) // Gartley
                         ObjectSetText(nameObj,fitxt[ki],ExtSizeTxt,"Arial", ExtGartley866);
                       else
                         ObjectSetText(nameObj,fitxt[ki],ExtSizeTxt,"Arial",ExtPesavento);
                      }
                     }
                  else
                    // ??????????? (? ??????0.866)
                    {
                     if (ExtHidden==1 || ExtHidden==4)
                       {
                        nameObj="phtxt" + Time[numHighPrim] + "_" + Time[numHighLast];

                        ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],MathAbs((High[numHighPrim]+High[numHighLast])/2));
                        ObjectSetText(nameObj,""+DoubleToStr(kk,2),ExtSizeTxt,"Arial",ExtNotFibo);
                       }
                    }

                  if ((ExtHidden==2 &amp;&amp; k2&lt;0) || ExtHidden!=2)
                    {
                     nameObj="ph" + Time[numHighPrim] + "_" + Time[numHighLast];

                     ObjectCreate(nameObj,OBJ_TREND,0,Time[numHighPrim],High[numHighPrim],Time[numHighLast],High[numHighLast]);
                     ObjectSet(nameObj,OBJPROP_RAY,false);
                     ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DOT);
                     ObjectSet(nameObj,OBJPROP_COLOR,ExtLine);
                    }
                 }
              }
           }
         else
            {numHighPrim=k; HighPrim=High[k];}
        }
       // ????? ?????????
       if (k&gt;countBarEnd)
         {
          k=numHighPrim+1; countHigh1--; countFr--;
          numLowPrim=0; numLowLast=0;
          numHighPrim=0; numHighLast=0;

          LowPrim=0.0; LowLast=0.0;
          HighPrim=0.0; HighLast=0.0;

          Angle=-100;
         }
     }
//-----------1 ??????????. ???

//-----------2 ?????????? ???.
//+-------------------------------------------------------------------------+
//| ????????? ?????????????0.866 ?? ?????ZigZag-a
//| ??????? ? ???? ??
//+-------------------------------------------------------------------------+

   numLowPrim=0; numLowLast=0;
   numHighPrim=0; numHighLast=0;

   LowPrim=0.0; LowLast=0.0;
   HighPrim=0.0; HighLast=0.0;

   Angle=-100;

   if (flagFrNew) countFr=1;
   else countFr=ExtFractal;

   for (k=0; (k&lt;Bars-1 &amp;&amp; countLow1&gt;0 &amp;&amp; countFr&gt;0); k++)
     {
      if (zzH[k]&gt;HighPrim &amp;&amp; LowPrim&gt;0) {HighPrim=High[k]; numHighPrim=k;}
      if (zzL[k]&gt;0.0 &amp;&amp; zzL[k]==zz[k])
        {
         if (LowPrim&gt;0)
           {
            if (LowLast&gt;0)
              {
               LowLast=Low[k]; numLowLast=k;
              }
            else {numLowLast=k; LowLast=Low[k];}

            // ????????? ????????????????(????????
            HL=High[numHighPrim]-Low[numLowLast];
            kj=(LowPrim-LowLast)*1000/(numLowLast-numLowPrim);
            if (HL&gt;0 &amp;&amp; (Angle&lt;kj || Angle==-100))  // ???? ?? ???????
              {
               Angle=kj;

               HLp=High[numHighPrim]-Low[numLowPrim];
               k1=MathCeil((numLowPrim+numLowLast)/2);
               kj=HLp/HL;

               if (kj&gt;0.21 &amp;&amp; kj&lt;=5)
                 {
                  // ???? ????? ????(????????. % ??????? ????????
                  kk=kj;
                  k2=1;

                  if (ExtDeltaType==2) for (ki=0;ki&lt;=16;ki++) {if (MathAbs((fi[ki]-kj)/fi[ki])&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}
                  if (ExtDeltaType==1) for (ki=0;ki&lt;=16;ki++) {if (MathAbs(fi[ki]-kj)&lt;=ExtDelta) {kk=fi[ki]; k2=-1; break;}}

                  if (k2&lt;0)
                  // ??????????? ?????????0.866
                    {
                     if (ExtHidden!=4)
                       {
                        nameObj="pltxt" + Time[numLowPrim] + "_" + Time[numLowLast];

                        ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],MathAbs((Low[numLowPrim]+Low[numLowLast])/2));
                        if (kk==0.886) // Gartley
                          ObjectSetText(nameObj,fitxt[ki],ExtSizeTxt,"Arial", ExtGartley866);
                        else
                          ObjectSetText(nameObj,fitxt[ki],ExtSizeTxt,"Arial",ExtPesavento);
                       }
                    }
                  else
                    // ??????????? (? ??????0.866)
                    {
                     if (ExtHidden==1 || ExtHidden==4)
                       {
                        nameObj="pltxt" + Time[numLowPrim] + "_" + Time[numLowLast];

                        ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],MathAbs((Low[numLowPrim]+Low[numLowLast])/2));
                        ObjectSetText(nameObj,""+DoubleToStr(kk,2),ExtSizeTxt,"Arial",ExtNotFibo);
                       }
                     }

                   if ((ExtHidden==2 &amp;&amp; k2&lt;0) || ExtHidden!=2)
                     {
                      nameObj="pl" + Time[numLowPrim] + "_" + Time[numLowLast];

                      ObjectCreate(nameObj,OBJ_TREND,0,Time[numLowPrim],Low[numLowPrim],Time[numLowLast],Low[numLowLast]);
                      ObjectSet(nameObj,OBJPROP_RAY,false);
                      ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DOT);
                      ObjectSet(nameObj,OBJPROP_COLOR,ExtLine);
                     }
                  }
               }
           }
         else {numLowPrim=k; LowPrim=Low[k];}
        }
       // ????? ?????????
       if (k&gt;countBarEnd)
         {
          k=numLowPrim+1; countLow1--; countFr--;

          numLowPrim=0; numLowLast=0;
          numHighPrim=0; numHighLast=0;

          LowPrim=0.0; LowLast=0.0;
          HighPrim=0.0; HighLast=0.0;

          Angle=-100;
         }
     }

//-----------2 ?????????? ???

  }
//-----------------------------------------
// ?? ??? ??????? ??? ???
//-----------------------------------------

//======================
//======================
//======================
  } // ????? ? ???????. ???
// ???
  } // start

//----------------------------------------------------
//  ?????? ?????
//----------------------------------------------------

//--------------------------------------------------------
// ????????? ????? ???????????. ???.
//--------------------------------------------------------
void countFractal()
  {
   int shift;
   countLow1=0;
   countHigh1=0;
   if (flagFrNew)
     {
      for(shift=0; shift&lt;=numBar; shift++)
        {
         if (zzL[shift]&gt;0.0) {countLow1++;}
         if (zzH[shift]&gt;0.0) {countHigh1++;}
        }
      flagFrNew=false;
      numBar=0;
      counted_bars=Bars-4;
     }
   else
     {
      for(shift=0; shift&lt;=countBarEnd; shift++)
        {
         if (zzL[shift]&gt;0.0) {countLow1++;}
         if (zzH[shift]&gt;0.0) {countHigh1++;}
        }
     }
   return ;
  }
//--------------------------------------------------------
// ????????? ????? ???????????. ???
//--------------------------------------------------------

//--------------------------------------------------------
// ?????? ???? ???.
//
// ?????????? ?? ??? ???????????
// ??????? ????????????? ??????????? ZigZag-a.
//--------------------------------------------------------
void matriza()
  {
   if (afrm)
     {
      int shift,k;
      k=0;
      for (shift=0; shift&lt;Bars &amp;&amp; k&lt;10; shift++)
        {
         if (zz[shift]&gt;0)
           {
            afr[k]=Time[shift];
            if (zz[shift]==zzL[shift]) {afrl[k]=Low[shift]; afrh[k]=0.0;}
            if (zz[shift]==zzH[shift]) {afrh[k]=High[shift]; afrl[k]=0.0;}
            k++;
           }
        }
      afrm=false;
      // ???????????????? ??
      if (ExtFiboStatic)
        {
         ExtFiboStatic=false;
         screenFiboS();
        }
      if (ExtFiboDinamic)
        {
         screenFiboD();
        }
     }
   return ;
  }
//--------------------------------------------------------
// ?????? ???? ???
//--------------------------------------------------------

//--------------------------------------------------------
// ??????????? ???.
//--------------------------------------------------------
void screenFiboS()
  {
   double fibo_0, fibo_100, fiboPrice, fiboPrice1;

   nameObj="fiboS";
   numOb=ObjectFind(nameObj);
   if (numOb&gt;-1) ObjectDelete(nameObj);
   if (afrl[ExtFiboStaticNum-1]&gt;0)
     {
      fibo_0=afrh[ExtFiboStaticNum];fibo_100=afrl[ExtFiboStaticNum-1];
      fiboPrice=afrh[ExtFiboStaticNum]-afrl[ExtFiboStaticNum-1];fiboPrice1=afrl[ExtFiboStaticNum-1];
     }
   else
     {
      fibo_0=afrl[ExtFiboStaticNum];fibo_100=afrh[ExtFiboStaticNum-1];
      fiboPrice=afrl[ExtFiboStaticNum]-afrh[ExtFiboStaticNum-1];fiboPrice1=afrh[ExtFiboStaticNum-1];
     }

   ObjectCreate(nameObj,OBJ_FIBO,0,afr[2],fibo_0,afr[1],fibo_100);
   ObjectSet(nameObj,OBJPROP_LEVELSTYLE,STYLE_DOT);
   ObjectSet(nameObj,OBJPROP_FIBOLEVELS,18);
   ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboS);

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL,0);
   ObjectSetFiboDescription(nameObj, 0, "0  --&gt;  "+DoubleToStr(fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+1,0.382);
   ObjectSetFiboDescription(nameObj, 1, "38.2  --&gt;  "+DoubleToStr(fiboPrice*0.382+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+2,0.5);
   ObjectSetFiboDescription(nameObj, 2, "50.0  --&gt;  "+DoubleToStr(fiboPrice*0.5+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+3,0.618);
   ObjectSetFiboDescription(nameObj, 3, "61.8  --&gt;  "+DoubleToStr(fiboPrice*0.618+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+4,0.707);
   ObjectSetFiboDescription(nameObj, 4, "70.7  --&gt;  "+DoubleToStr(fiboPrice*0.707+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+5,0.786);
   ObjectSetFiboDescription(nameObj, 5, "78.6  --&gt;  "+DoubleToStr(fiboPrice*0.786+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+6,0.841);
   ObjectSetFiboDescription(nameObj, 6, "84.1  --&gt;  "+DoubleToStr(fiboPrice*0.841+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+7,0.886);
   ObjectSetFiboDescription(nameObj, 7, "88.6  --&gt;  "+DoubleToStr(fiboPrice*0.886+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+8,1.0);
   ObjectSetFiboDescription(nameObj, 8, "100.0  --&gt;  "+DoubleToStr(fiboPrice+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+9,1.127);
   ObjectSetFiboDescription(nameObj, 9, "112.8  --&gt;  "+DoubleToStr(fiboPrice*1.128+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+10,1.272);
   ObjectSetFiboDescription(nameObj, 10, "127.2  --&gt;  "+DoubleToStr(fiboPrice*1.272+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+11,1.414);
   ObjectSetFiboDescription(nameObj, 11, "141.4  --&gt;  "+DoubleToStr(fiboPrice*1.414+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+12,1.618);
   ObjectSetFiboDescription(nameObj, 12, "161.8  --&gt;  "+DoubleToStr(fiboPrice*1.618+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+13,2.0);
   ObjectSetFiboDescription(nameObj, 13, "200.0  --&gt;  "+DoubleToStr(fiboPrice*2.0+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+14,2.414);
   ObjectSetFiboDescription(nameObj, 14, "241.4  --&gt;  "+DoubleToStr(fiboPrice*2.414+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+15,2.618);
   ObjectSetFiboDescription(nameObj, 15, "261.8  --&gt;  "+DoubleToStr(fiboPrice*2.618+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+16,4.236);
   ObjectSetFiboDescription(nameObj, 16, "423.6  --&gt;  "+DoubleToStr(fiboPrice*4.236+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+17,6.854);
   ObjectSetFiboDescription(nameObj, 17, "685.4  --&gt;  "+DoubleToStr(fiboPrice*6.854+fiboPrice1, 4) );

   return ;
  }
//--------------------------------------------------------
// ??????????? ???
//--------------------------------------------------------

//--------------------------------------------------------
// ???????????. ???.
//--------------------------------------------------------
void screenFiboD()
  {
   double fibo_0, fibo_100, fiboPrice, fiboPrice1;

   nameObj="fiboD";
   numOb=ObjectFind(nameObj);
   if (numOb&gt;-1) ObjectDelete(nameObj);
   if (afrh[1]&gt;0) {fibo_0=afrh[1];fibo_100=afrl[0];fiboPrice=afrh[1]-afrl[0];fiboPrice1=afrl[0];}
   else {fibo_0=afrl[1];fibo_100=afrh[0];fiboPrice=afrl[1]-afrh[0];fiboPrice1=afrh[0];}

   ObjectCreate(nameObj,OBJ_FIBO,0,afr[2],fibo_0,afr[1],fibo_100);
   ObjectSet(nameObj,OBJPROP_LEVELSTYLE,STYLE_DOT);
   ObjectSet(nameObj,OBJPROP_FIBOLEVELS,18);
   ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboD);

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL,0);
   ObjectSetFiboDescription(nameObj, 0, "0  --&gt;  "+DoubleToStr(fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+1,0.382);
   ObjectSetFiboDescription(nameObj, 1, "38.2  --&gt;  "+DoubleToStr(fiboPrice*0.382+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+2,0.5);
   ObjectSetFiboDescription(nameObj, 2, "50.0  --&gt;  "+DoubleToStr(fiboPrice*0.5+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+3,0.618);
   ObjectSetFiboDescription(nameObj, 3, "61.8  --&gt;  "+DoubleToStr(fiboPrice*0.618+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+4,0.707);
   ObjectSetFiboDescription(nameObj, 4, "70.7  --&gt;  "+DoubleToStr(fiboPrice*0.707+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+5,0.786);
   ObjectSetFiboDescription(nameObj, 5, "78.6  --&gt;  "+DoubleToStr(fiboPrice*0.786+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+6,0.841);
   ObjectSetFiboDescription(nameObj, 6, "84.1  --&gt;  "+DoubleToStr(fiboPrice*0.841+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+7,0.886);
   ObjectSetFiboDescription(nameObj, 7, "88.6  --&gt;  "+DoubleToStr(fiboPrice*0.886+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+8,1.0);
   ObjectSetFiboDescription(nameObj, 8, "100.0  --&gt;  "+DoubleToStr(fiboPrice+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+9,1.127);
   ObjectSetFiboDescription(nameObj, 9, "112.8  --&gt;  "+DoubleToStr(fiboPrice*1.128+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+10,1.272);
   ObjectSetFiboDescription(nameObj, 10, "127.2  --&gt;  "+DoubleToStr(fiboPrice*1.272+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+11,1.414);
   ObjectSetFiboDescription(nameObj, 11, "141.4  --&gt;  "+DoubleToStr(fiboPrice*1.414+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+12,1.618);
   ObjectSetFiboDescription(nameObj, 12, "161.8  --&gt;  "+DoubleToStr(fiboPrice*1.618+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+13,2.0);
   ObjectSetFiboDescription(nameObj, 13, "200.0  --&gt;  "+DoubleToStr(fiboPrice*2.0+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+14,2.414);
   ObjectSetFiboDescription(nameObj, 14, "241.4  --&gt;  "+DoubleToStr(fiboPrice*2.414+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+15,2.618);
   ObjectSetFiboDescription(nameObj, 15, "261.8  --&gt;  "+DoubleToStr(fiboPrice*2.618+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+16,4.236);
   ObjectSetFiboDescription(nameObj, 16, "423.6  --&gt;  "+DoubleToStr(fiboPrice*4.236+fiboPrice1, 4) );

   ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+17,6.854);
   ObjectSetFiboDescription(nameObj, 17, "685.4  --&gt;  "+DoubleToStr(fiboPrice*6.854+fiboPrice1, 4) );

   return ;
  }
//--------------------------------------------------------
// ???????????. ???
//--------------------------------------------------------

//Print ();
//--------------------------------------------------------
// ???? ????. ???.
// ???? ??????? ???????
//--------------------------------------------------------
void delete_objects1()
{
int i;
string txt;

for (i=ObjectsTotal(); i&gt;=0; i--)
  {
   txt=ObjectName(i);
   if (StringFind(txt,"pl")&gt;-1)ObjectDelete (txt);
   if (StringFind(txt,"ph")&gt;-1) ObjectDelete (txt);
  }
return;
}
//--------------------------------------------------------
// ???? ????. ???.
// ???? ??????? ???????
//--------------------------------------------------------
//----------------------------------------------------
//  ZigZag (? ?4 ?????????). ???.
//----------------------------------------------------
void ZigZag_()
  {
//  ZigZag ? ?. ???.
   int    shift, back,lasthighpos,lastlowpos;
   double val,res;
   double curlow,curhigh,lasthigh,lastlow;

   for(shift=Bars-minBars; shift&gt;=0; shift--)
     {
      val=Low[Lowest(NULL,0,MODE_LOW,minBars,shift)];
      if(val==lastlow) val=0.0;
      else
        {
         lastlow=val;
         if((Low[shift]-val)&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=zzL[shift+back];
               if((res!=0)&amp;&amp;(res&gt;val)) zzL[shift+back]=0.0;
              }
           }
        }
      zzL[shift]=val;
      //--- high
      val=High[Highest(NULL,0,MODE_HIGH,minBars,shift)];
      if(val==lasthigh) val=0.0;
      else
        {
         lasthigh=val;
         if((val-High[shift])&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=zzH[shift+back];
               if((res!=0)&amp;&amp;(res&lt;val)) zzH[shift+back]=0.0;
              }
           }
        }
      zzH[shift]=val;
     }

   // final cutting
   lasthigh=-1; lasthighpos=-1;
   lastlow=-1;  lastlowpos=-1;

   for(shift=Bars-minBars; shift&gt;=0; shift--)
     {
      curlow=zzL[shift];
      curhigh=zzH[shift];
      if((curlow==0)&amp;&amp;(curhigh==0)) continue;
      //---
      if(curhigh!=0)
        {
         if(lasthigh&gt;0)
           {
            if(lasthigh&lt;curhigh) zzH[lasthighpos]=0;
            else zzH[shift]=0;
           }
         //---
         if(lasthigh&lt;curhigh || lasthigh&lt;0)
           {
            lasthigh=curhigh;
            lasthighpos=shift;
           }
         lastlow=-1;
        }
      //----
      if(curlow!=0)
        {
         if(lastlow&gt;0)
           {
            if(lastlow&gt;curlow) zzL[lastlowpos]=0;
            else zzL[shift]=0;
           }
         //---
         if((curlow&lt;lastlow)||(lastlow&lt;0))
           {
            lastlow=curlow;
            lastlowpos=shift;
           }
         lasthigh=-1;
        }
     }

   for(shift=Bars-1; shift&gt;=0; shift--)
     {
      zz[shift]=zzL[shift];
      if(shift&gt;=Bars-minBars) {zzH[shift]=0.0;zzL[shift]=0.0; zz[shift]=0.0;}
      else
        {
         res=zzH[shift];
         if(res!=0.0) zz[shift]=res;
        }
     }

   return;
  }
//--------------------------------------------------------
// ZigZag ? ?. ???
//--------------------------------------------------------

//----------------------------------------------------
//  ZigZag ??? ?????????. ???.
//----------------------------------------------------
void ang_AZZ_()
 {
   int i,n,cbi;
//   double res;
   cbi=Bars-IndicatorCounted()-1;
//---------------------------------
   for (i=cbi; i&gt;=0; i--)
     {
//-------------------------------------------------
      // ????? ???? ?????? ??? fs ??????? si ? ????? ??
      if (ti!=Time[i]) {fsp=fs; sip=si;} ti=Time[i];
      // ????? ???? ???? ????? ???? ?????
      if (minSize==0 &amp;&amp; minPercent!=0) di=minPercent*Close[i]/2/100;
//-------------------------------------------------
      // ?????????????
      if (High[i]&gt;=si+di &amp;&amp; Low[i]&lt;si-di) // ??????? ?????????? ????di
        {
         if (High[i]-si&gt;=si-Low[i]) si=High[i]-di;  // ????? ?? ? ?????? ??? ????? ??
         if (High[i]-si&lt;si-Low[i]) si=Low[i]+di;  // ???????, ???
        }
      else  // ? ??????
        {
         if (High[i]&gt;=si+di) si=High[i]-di;   //
         if (Low[i]&lt;=si-di) si=Low[i]+di;   //
        }

      // ????? ????? ???? ??????
      if (i&gt;Bars-2) {si=(High[i]+Low[i])/2;}
      // ????? ??? ?? ???????????
      if (chHL) {ha[i]=si+di; la[i]=si-di;}

      // ????? ????????? ?? ????? ??
      if (si&gt;sip) fs=1; // ?????????
      if (si&lt;sip) fs=2; // ?????????

//-------------------------------------------------

      if (fs==1 &amp;&amp; fsp==2) // ??????? ??????? ? ??????
        {
         hm=High[i];
         Last_Bar=iBarShift(Symbol(),Period(),tbiLast);
         zz[Last_Bar]=Low[Last_Bar];
         zzL[Last_Bar]=Low[Last_Bar];
         zzH[Last_Bar]=0;
         if (PeakDet) for (n=bip; n&gt;=bi; n--) {lam[n]=Low[bip];}
         aip=ai; ai=i; taiLast=Time[i];
         t0=Time[i];
         LastBar0=0;
         fsp=fs;
        }

      if (fs==2 &amp;&amp; fsp==1) // ??????? ??????? ? ??????
        {
         lm=Low[i];
         Last_Bar=iBarShift(Symbol(),Period(),taiLast);
         zz[Last_Bar]=High[Last_Bar];
         zzH[Last_Bar]=High[Last_Bar];
         zzL[Last_Bar]=0;
         if (PeakDet) for (n=aip; n&gt;=ai; n--) {ham[n]=High[aip];}
         bip=bi; bi=i; tbiLast=Time[i];
         t0=Time[i];
         LastBar0=0;
         fsp=fs;
        }

      // ??????t??? ?????? ???.
      if (fs==1 &amp;&amp; High[i]&gt;hm)
        {hm=High[i]; ai=i; taiLast=Time[i];}
      if (fs==2 &amp;&amp; Low[i]&lt;lm)
        {lm=Low[i]; bi=i; tbiLast=Time[i];}

//===================================================================================================
      // ??????
      if (i==0)
        {
         tai=Time[ai];
         tbi=Time[bi];
         taip=Time[aip];
         tbip=Time[bip];

         ai0=iBarShift(Symbol(),Period(),tai);
         bi0=iBarShift(Symbol(),Period(),tbi);
         aip0=iBarShift(Symbol(),Period(),taip);
         bip0=iBarShift(Symbol(),Period(),tbip);

         if (fs==1)
           {

            if (LastBar0==0) // ????????????? "????" ??. ???.
              {
               last0=iBarShift(Symbol(),Period(),tbiLast);
               LastBar0=High[last0];
               t0=Time[last0];
               for (n=bi;n&gt;=0;n--)
                 {
                  if (LastBar0&lt;High[n])
                    {
                     LastBar0=High[n];
                     t0=Time[n];
                     last0=n;
                    }
                 }
               zz[last0]=LastBar0;
               zzH[last0]=LastBar0;
               zzL[last0]=0;
              }             // ????????????? "????" ??. ???

            if (LastBar0&lt;High[i])
              {
               if (t0&lt;Time[i])
                 {
                  last0=iBarShift(Symbol(),Period(),t0);
                  zz[last0]=0;
                  zzH[last0]=0;
                 }
               LastBar0=High[i];
               t0=Time[i];
               zz[i]=High[i];
               zzH[i]=High[i];
               zzL[i]=0;
              }
           }

         if (fs==2)
           {

            if (LastBar0==0) // ?????????? ?? "????" ??. ???.
              {
               last0=iBarShift(Symbol(),Period(),taiLast);
               LastBar0=Low[last0];
               t0=Time[last0];
               for (n=ai;n&gt;=0;n--)
                 {
                  if (LastBar0&gt;Low[n])
                    {
                     LastBar0=Low[n];
                     t0=Time[n];
                     last0=n;
                    }
                 }
               zz[last0]=LastBar0;
               zzH[last0]=0;
               zzL[last0]=LastBar0;
              }             // ?????????? ?? "????" ??. ???

            if (LastBar0&gt;Low[i])
              {
               if (t0&lt;Time[i])
                 {
                  last0=iBarShift(Symbol(),Period(),t0);
                  zz[last0]=0;
                  zzL[last0]=0;
                 }
               LastBar0=Low[i];
               t0=Time[i];
               zz[i]=Low[i];
               zzL[i]=Low[i];
               zzH[i]=0;
              }
           }

         if (PeakDet)
           {
            if (fs==1) {for (n=aip0; n&gt;=0; n--) {ham[n]=High[aip0];} for (n=bi0; n&gt;=0; n--) {lam[n]=Low[bi0];} }
            if (fs==2) {for (n=bip0; n&gt;=0; n--) {lam[n]=Low[bip0];} for (n=ai0; n&gt;=0; n--) {ham[n]=High[ai0];} }
           }
//-------------------------------------------------------------
        }
//====================================================================================================
     }
//--------------------------------------------

  return(0);
 }

//--------------------------------------------------------
// ZigZag ???. ???
//--------------------------------------------------------

//----------------------------------------------------
// ????????? ???????Ensign. ???.
//----------------------------------------------------
void Ensign_ZZ()
 {
   int i,n,cbi;

   cbi=Bars-IndicatorCounted()-1;
//---------------------------------
   for (i=cbi; i&gt;=0; i--)
     {
//-------------------------------------------------
      // ???????????????? ???? ????????
      if (lLast==0) {lLast=Low[i];hLast=High[i];}
      // ????? ????????? ? ??? ?????????.
      // ??? ?????? ?????? ? ??????
      if (fs==0)
        {
         if (lLast&lt;Low[i] &amp;&amp; hLast&lt;High[i]) {fs=1; si=High[i]; ai=i;}  // ?????????
         if (lLast&gt;Low[i] &amp;&amp; hLast&gt;High[i]) {fs=2; si=Low[i]; bi=i;}  // ?????????
        }

      if (ti!=Time[i])
        {
         // ????? ???? ?????? ??? fs ? ????? ??
         fsp=fs;
         ti=Time[i];
         // ????? ?????????????????? ???.
         if (fs==1 &amp;&amp; hLast&gt;High[i]) fh=true;
         if (fh &amp;&amp; countBar&gt;0) countBar--;
         if (fs==2 &amp;&amp; lLast&lt;Low[i]) fl=true;
         if (fl &amp;&amp; countBar&gt;0) countBar--;
        }

      // ?????????
      if (fs==1 &amp;&amp; High[i]&gt;si) {ai=i; tai=Time[i]; hLast=High[i]; si=High[i]; countBar=minBars; fh=false;}
      if (fs==2 &amp;&amp; Low[i]&lt;si) {bi=i; tbi=Time[i]; lLast=Low[i]; si=Low[i]; countBar=minBars; fl=false;}

      if ((countBar==0 || Close[i]&lt;lLast) &amp;&amp; fh)
        {
         fh=false;
         if (si-di&gt;Low[i] &amp;&amp; High[i]&lt;hLast) {fs=2; countBar=minBars; fh=false;}
        }

      if ((countBar==0 || Close[i]&gt;hLast) &amp;&amp; fl)
        {
         fl=false;
         if (si+di&lt;High[i] &amp;&amp; Low[i]&gt;lLast) {fs=1; countBar=minBars; fl=false;}
        }

//-------------------------------------------------
      if (fs==1 &amp;&amp; fsp==2) // ??????? ??????? ? ??????
        {
         zz[bi]=Low[bi];
         zzL[bi]=Low[bi];
         if (PeakDet) for (n=bip; n&gt;=bi; n--) {lam[n]=Low[bip];}
         hLast=High[i];
         si=High[i];
         aip=ai;
         ai=i;
         tai=Time[i];
         taip=Time[i];
         fsp=fs;
        }

      if (fs==2 &amp;&amp; fsp==1) // ??????? ??????? ? ??????
        {
         zz[ai]=High[ai];
         zzH[ai]=High[ai];
         if (PeakDet) for (n=aip; n&gt;=ai; n--) {ham[n]=High[aip];}
         lLast=Low[i];
         si=Low[i];
         bip=bi;
         bi=i;
         tbi=Time[i];
         tbip=Time[i];
         fsp=fs;
        }

//===================================================================================================
      // ?????? ??? ?????? ZigZag-a

      if (i==0)
        {
         ai0=iBarShift(Symbol(),Period(),tai);
         bi0=iBarShift(Symbol(),Period(),tbi);
         aip0=iBarShift(Symbol(),Period(),taip);
         bip0=iBarShift(Symbol(),Period(),tbip);

         if (fs==1) { for (n=bi0-1; n&gt;ai0; n--) {zzH[n]=0; zz[n]=0;} zz[ai0]=High[ai0]; zzH[ai0]=High[ai0]; zzL[ai0]=0;}
         if (fs==2) {for (n=ai0-1; n&gt;bi0; n--) {zzL[n]=0; zz[n]=0;} zz[bi0]=Low[bi0]; zzL[bi0]=Low[bi0]; zzH[bi0]=0;}

         if (PeakDet)
           {
            if (fs==1) {for (n=aip0; n&gt;=0; n--) {ham[n]=High[aip0];} for (n=bi0; n&gt;=0; n--) {lam[n]=Low[bi0];} }
            if (fs==2) {for (n=bip0; n&gt;=0; n--) {lam[n]=Low[bip0];} for (n=ai0; n&gt;=0; n--) {ham[n]=High[ai0];} }
           }
//-------------------------------------------------------------
        }

//====================================================================================================
     }
//--------------------------------------------
  return(0);
 }
//--------------------------------------------------------
// ????????? ???????Ensign. ???
//--------------------------------------------------------</pre>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fforexdecode.com%2Fzup_v14mq4%2F', 'ZUP_v14.mq4')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fforexdecode.com%2Fzup_v14mq4%2F', title: '+ZUP_v14.mq4+' })"/></div><p align="left"><a class="tt" href="http://twitter.com/home/?status=ZUP_v14.mq4+http://gf3ad.th8.us" title="Post to Twitter"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a class="tt" href="http://twitter.com/home/?status=ZUP_v14.mq4+http://gf3ad.th8.us" title="Post to Twitter">Tweet This Post</a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zup_v14mq4/&amp;title=ZUP_v14.mq4" title="Post to Delicious"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-delicious-big1.png" alt="[Post to Delicious]" border="0" /></a> <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zup_v14mq4/&amp;title=ZUP_v14.mq4" title="Post to Delicious">Delicious This Post</a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZUP_v14.mq4&amp;link=http://forexdecode.com/zup_v14mq4/" title="Post to Ping.fm"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-ping-big1.png" alt="[Post to Ping.fm]" border="0" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZUP_v14.mq4&amp;link=http://forexdecode.com/zup_v14mq4/" title="Post to Ping.fm">Ping This Post</a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zup_v14mq4/&amp;title=ZUP_v14.mq4" title="Post to StumbleUpon"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-su-big1.png" alt="[Post to StumbleUpon]" border="0" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zup_v14mq4/&amp;title=ZUP_v14.mq4" title="Post to StumbleUpon">Stumble This Post</a>&nbsp; </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/forexdecode?a=IgUOwZNYaS8:P0xdPWpEmn4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=IgUOwZNYaS8:P0xdPWpEmn4:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=IgUOwZNYaS8:P0xdPWpEmn4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=IgUOwZNYaS8:P0xdPWpEmn4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=IgUOwZNYaS8:P0xdPWpEmn4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=IgUOwZNYaS8:P0xdPWpEmn4:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=IgUOwZNYaS8:P0xdPWpEmn4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=IgUOwZNYaS8:P0xdPWpEmn4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=IgUOwZNYaS8:P0xdPWpEmn4:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=IgUOwZNYaS8:P0xdPWpEmn4:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=IgUOwZNYaS8:P0xdPWpEmn4:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/forexdecode/~4/IgUOwZNYaS8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forexdecode.com/zup_v14mq4/feed/</wfw:commentRss>
		<feedburner:origLink>http://forexdecode.com/zup_v14mq4/</feedburner:origLink></item>
		<item>
		<title>ZigZagFirst.mq4</title>
		<link>http://feedproxy.google.com/~r/forexdecode/~3/dFkl-7X3sLs/</link>
		<comments>http://forexdecode.com/zigzagfirstmq4/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 16:54:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Metatrader Indicator Code]]></category>

		<category><![CDATA[Z]]></category>

		<category><![CDATA[ZigZagFirst.mq4]]></category>

		<guid isPermaLink="false">http://forexdecode.com/?p=997</guid>
		<description><![CDATA[//+------------------------------------------------------------------+
//&#124;                                        Custom Moving Average.mq4 &#124;
//&#124;            [...]]]></description>
			<content:encoded><![CDATA[<pre>//+------------------------------------------------------------------+
//|                                        Custom Moving Average.mq4 |
//|                      Copyright ?2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 White
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
//---- drawing settings
   SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtMapBuffer);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(0,0.0);
   ArraySetAsSeries(ExtMapBuffer,true);
   ArraySetAsSeries(ExtMapBuffer2,true);
//---- indicator short name
   IndicatorShortName("ZigZagFirstBar("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    shift, back,lasthighpos,lastlowpos;
   double val,res;
   double curlow,curhigh,lasthigh,lastlow;

   for(shift=Bars-ExtDepth; shift&gt;=0; shift--)
     {
      val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)];
      if(val==lastlow) val=0.0;
      else
        {
         lastlow=val;
         if((Low[shift]-val)&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer[shift+back];
               if((res!=0)&amp;&amp;(res&gt;val)) continue;//ExtMapBuffer[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer[shift]=val;
      //--- high
      val=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)];
      if(val==lasthigh) val=0.0;
      else
        {
         lasthigh=val;
         if((val-High[shift])&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer2[shift+back];
               if((res!=0)&amp;&amp;(res&lt;val)) continue;//ExtMapBuffer2[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer2[shift]=val;
     }

   // final cutting
   lasthigh=-1; lasthighpos=-1;
   lastlow=-1;  lastlowpos=-1;

   for(shift=Bars-ExtDepth; shift&gt;=0; shift--)
     {
      curlow=ExtMapBuffer[shift];
      curhigh=ExtMapBuffer2[shift];
//      if((curlow==0.0)||(curhigh==0.0)) continue;
      //---
      if(curhigh!=0)
        {
         if(lasthigh&gt;0)
           {
            if(lasthigh&lt;curhigh) ExtMapBuffer2[lasthighpos]=0;
            else ExtMapBuffer2[shift]=0;
           };//?
         //---
         if(lasthigh&lt;curhigh || lasthigh&lt;0)
           {
            lasthigh=curhigh;
            lasthighpos=shift;
           };// ?
         lastlow=-1;
        };//?
      //----
      if(curlow!=0)
        {
         if(lastlow&gt;0)
           {
            if(lastlow&gt;curlow) ExtMapBuffer[lastlowpos]=0;
            else ExtMapBuffer[shift]=0;
           };//z
         //---
         if((curlow&lt;lastlow)||(lastlow&lt;0))
           {
            lastlow=curlow;
            lastlowpos=shift;
           };//z
         lasthigh=-1;
        };//
     }

   for(shift=Bars-1; shift&gt;=0; shift--)
     {
      if(shift&gt;=Bars-ExtDepth) ExtMapBuffer[shift]=0.0;
      else
        {
         res=ExtMapBuffer2[shift];
         if(res!=0.0) ExtMapBuffer[shift]=res;
         //if(res&gt;0.0) ExtMapBuffer[shift]=res;
        }
     }
  }</pre>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fforexdecode.com%2Fzigzagfirstmq4%2F', 'ZigZagFirst.mq4')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fforexdecode.com%2Fzigzagfirstmq4%2F', title: '+ZigZagFirst.mq4+' })"/></div><p align="left"><a class="tt" href="http://twitter.com/home/?status=ZigZagFirst.mq4+http://bzxf2.th8.us" title="Post to Twitter"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a class="tt" href="http://twitter.com/home/?status=ZigZagFirst.mq4+http://bzxf2.th8.us" title="Post to Twitter">Tweet This Post</a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zigzagfirstmq4/&amp;title=ZigZagFirst.mq4" title="Post to Delicious"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-delicious-big1.png" alt="[Post to Delicious]" border="0" /></a> <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zigzagfirstmq4/&amp;title=ZigZagFirst.mq4" title="Post to Delicious">Delicious This Post</a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZigZagFirst.mq4&amp;link=http://forexdecode.com/zigzagfirstmq4/" title="Post to Ping.fm"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-ping-big1.png" alt="[Post to Ping.fm]" border="0" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZigZagFirst.mq4&amp;link=http://forexdecode.com/zigzagfirstmq4/" title="Post to Ping.fm">Ping This Post</a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zigzagfirstmq4/&amp;title=ZigZagFirst.mq4" title="Post to StumbleUpon"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-su-big1.png" alt="[Post to StumbleUpon]" border="0" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zigzagfirstmq4/&amp;title=ZigZagFirst.mq4" title="Post to StumbleUpon">Stumble This Post</a>&nbsp; </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/forexdecode?a=dFkl-7X3sLs:Ji12aPnqOBw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=dFkl-7X3sLs:Ji12aPnqOBw:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=dFkl-7X3sLs:Ji12aPnqOBw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=dFkl-7X3sLs:Ji12aPnqOBw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=dFkl-7X3sLs:Ji12aPnqOBw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=dFkl-7X3sLs:Ji12aPnqOBw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=dFkl-7X3sLs:Ji12aPnqOBw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=dFkl-7X3sLs:Ji12aPnqOBw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=dFkl-7X3sLs:Ji12aPnqOBw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=dFkl-7X3sLs:Ji12aPnqOBw:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=dFkl-7X3sLs:Ji12aPnqOBw:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/forexdecode/~4/dFkl-7X3sLs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forexdecode.com/zigzagfirstmq4/feed/</wfw:commentRss>
		<feedburner:origLink>http://forexdecode.com/zigzagfirstmq4/</feedburner:origLink></item>
		<item>
		<title>ZigZag_Fibo_v2beta.mq4</title>
		<link>http://feedproxy.google.com/~r/forexdecode/~3/K8Qbde7C8dQ/</link>
		<comments>http://forexdecode.com/zigzag_fibo_v2betamq4/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 16:53:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Metatrader Indicator Code]]></category>

		<category><![CDATA[Z]]></category>

		<category><![CDATA[ZigZag_Fibo_v2beta.mq4]]></category>

		<guid isPermaLink="false">http://forexdecode.com/?p=996</guid>
		<description><![CDATA[// fukinagashi

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtMapBuffer2[];

int OldLastZigZag, OldPreviousZigZag;

//+------------------------------------------------------------------+
//&#124; Custom indicator initialization function                         &#124;
//+------------------------------------------------------------------+
int init()
  {
   [...]]]></description>
			<content:encoded><![CDATA[<pre>// fukinagashi

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtMapBuffer2[];

int OldLastZigZag, OldPreviousZigZag;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
//---- drawing settings
   SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtMapBuffer);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(0,0.0);
   ArraySetAsSeries(ExtMapBuffer,true);
   ArraySetAsSeries(ExtMapBuffer2,true);
//---- indicator short name
   IndicatorShortName("Fibodrawer");
//---- initialization done
   return(0);
  }

int deinit() {
	ObjectDelete("Fibo");
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    shift, back,lasthighpos,lastlowpos;
   double val,res;
   double curlow,curhigh,lasthigh,lastlow;

   for(shift=Bars-ExtDepth; shift&gt;=0; shift--)
     {
      val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)];
      if(val==lastlow) val=0.0;
      else
        {
         lastlow=val;
         if((Low[shift]-val)&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer[shift+back];
               if((res!=0)&amp;&amp;(res&gt;val)) ExtMapBuffer[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer[shift]=val;
      //--- high
      val=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)];
      if(val==lasthigh) val=0.0;
      else
        {
         lasthigh=val;
         if((val-High[shift])&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer2[shift+back];
               if((res!=0)&amp;&amp;(res&lt;val)) ExtMapBuffer2[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer2[shift]=val;
     }

   // final cutting
   lasthigh=-1; lasthighpos=-1;
   lastlow=-1;  lastlowpos=-1;

   for(shift=Bars-ExtDepth; shift&gt;=0; shift--)
     {
      curlow=ExtMapBuffer[shift];
      curhigh=ExtMapBuffer2[shift];
      if((curlow==0)&amp;&amp;(curhigh==0)) continue;
      //---
      if(curhigh!=0)
        {
         if(lasthigh&gt;0)
           {
            if(lasthigh&lt;curhigh) ExtMapBuffer2[lasthighpos]=0;
            else ExtMapBuffer2[shift]=0;
           }
         //---
         if(lasthigh&lt;curhigh || lasthigh&lt;0)
           {
            lasthigh=curhigh;
            lasthighpos=shift;
           }
         lastlow=-1;
        }
      //----
      if(curlow!=0)
        {
         if(lastlow&gt;0)
           {
            if(lastlow&gt;curlow) ExtMapBuffer[lastlowpos]=0;
            else ExtMapBuffer[shift]=0;
           }
         //---
         if((curlow&lt;lastlow)||(lastlow&lt;0))
           {
            lastlow=curlow;
            lastlowpos=shift;
           }
         lasthigh=-1;
        }
     }

   for(shift=Bars-1; shift&gt;=0; shift--)
     {
      if(shift&gt;=Bars-ExtDepth) ExtMapBuffer[shift]=0.0;
      else
        {
         res=ExtMapBuffer2[shift];
         if(res!=0.0) ExtMapBuffer[shift]=res;
        }

     }

  	int i=0;
  	int LastZigZag, PreviousZigZag;

   int h=0;
   while ( ExtMapBuffer[h]==0 &amp;&amp; ExtMapBuffer2[h]==0) {
   	h++;
   }

   LastZigZag=h;

   h++;
   while(ExtMapBuffer[h]==0 &amp;&amp; ExtMapBuffer2[h]==0) {
   	h++;
   }

   PreviousZigZag=h;

   if (OldLastZigZag!=LastZigZag || OldPreviousZigZag!=PreviousZigZag) {
   	OldLastZigZag=LastZigZag;
   	OldPreviousZigZag=PreviousZigZag;
   	ObjectDelete("Fibo");
   	ObjectCreate("Fibo", OBJ_FIBO, 0, Time[PreviousZigZag], ExtMapBuffer[LastZigZag], Time[LastZigZag], ExtMapBuffer[PreviousZigZag]);
   	Alert("New ZigZag and new Fibo drawn");
   	PlaySound("alert.wav");
   }
}</pre>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fforexdecode.com%2Fzigzag_fibo_v2betamq4%2F', 'ZigZag_Fibo_v2beta.mq4')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fforexdecode.com%2Fzigzag_fibo_v2betamq4%2F', title: '+ZigZag_Fibo_v2beta.mq4+' })"/></div><p align="left"><a class="tt" href="http://twitter.com/home/?status=ZigZag_Fibo_v2beta.mq4+http://3b8c2.th8.us" title="Post to Twitter"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a class="tt" href="http://twitter.com/home/?status=ZigZag_Fibo_v2beta.mq4+http://3b8c2.th8.us" title="Post to Twitter">Tweet This Post</a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zigzag_fibo_v2betamq4/&amp;title=ZigZag_Fibo_v2beta.mq4" title="Post to Delicious"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-delicious-big1.png" alt="[Post to Delicious]" border="0" /></a> <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zigzag_fibo_v2betamq4/&amp;title=ZigZag_Fibo_v2beta.mq4" title="Post to Delicious">Delicious This Post</a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZigZag_Fibo_v2beta.mq4&amp;link=http://forexdecode.com/zigzag_fibo_v2betamq4/" title="Post to Ping.fm"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-ping-big1.png" alt="[Post to Ping.fm]" border="0" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZigZag_Fibo_v2beta.mq4&amp;link=http://forexdecode.com/zigzag_fibo_v2betamq4/" title="Post to Ping.fm">Ping This Post</a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zigzag_fibo_v2betamq4/&amp;title=ZigZag_Fibo_v2beta.mq4" title="Post to StumbleUpon"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-su-big1.png" alt="[Post to StumbleUpon]" border="0" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zigzag_fibo_v2betamq4/&amp;title=ZigZag_Fibo_v2beta.mq4" title="Post to StumbleUpon">Stumble This Post</a>&nbsp; </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/forexdecode?a=K8Qbde7C8dQ:5vIJTURlzBM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=K8Qbde7C8dQ:5vIJTURlzBM:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=K8Qbde7C8dQ:5vIJTURlzBM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=K8Qbde7C8dQ:5vIJTURlzBM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=K8Qbde7C8dQ:5vIJTURlzBM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=K8Qbde7C8dQ:5vIJTURlzBM:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=K8Qbde7C8dQ:5vIJTURlzBM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=K8Qbde7C8dQ:5vIJTURlzBM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=K8Qbde7C8dQ:5vIJTURlzBM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=K8Qbde7C8dQ:5vIJTURlzBM:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=K8Qbde7C8dQ:5vIJTURlzBM:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/forexdecode/~4/K8Qbde7C8dQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forexdecode.com/zigzag_fibo_v2betamq4/feed/</wfw:commentRss>
		<feedburner:origLink>http://forexdecode.com/zigzag_fibo_v2betamq4/</feedburner:origLink></item>
		<item>
		<title>ZigZag_Fibo_v1beta.mq4</title>
		<link>http://feedproxy.google.com/~r/forexdecode/~3/ZrwAgCmCE7k/</link>
		<comments>http://forexdecode.com/zigzag_fibo_v1betamq4/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 16:52:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Metatrader Indicator Code]]></category>

		<category><![CDATA[Z]]></category>

		<category><![CDATA[ZigZag_Fibo_v1beta.mq4]]></category>

		<guid isPermaLink="false">http://forexdecode.com/?p=995</guid>
		<description><![CDATA[// fukinagashi

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//&#124; Custom indicator initialization function                         &#124;
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
//---- drawing [...]]]></description>
			<content:encoded><![CDATA[<pre>// fukinagashi

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
//---- drawing settings
   SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtMapBuffer);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(0,0.0);
   ArraySetAsSeries(ExtMapBuffer,true);
   ArraySetAsSeries(ExtMapBuffer2,true);
//---- indicator short name
   IndicatorShortName("ZigZag("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")");
//---- initialization done
   return(0);
  }

int deinit() {
	ObjectDelete("Fibo");
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    shift, back,lasthighpos,lastlowpos;
   double val,res;
   double curlow,curhigh,lasthigh,lastlow;

   for(shift=Bars-ExtDepth; shift&gt;=0; shift--)
     {
      val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)];
      if(val==lastlow) val=0.0;
      else
        {
         lastlow=val;
         if((Low[shift]-val)&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer[shift+back];
               if((res!=0)&amp;&amp;(res&gt;val)) ExtMapBuffer[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer[shift]=val;
      //--- high
      val=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)];
      if(val==lasthigh) val=0.0;
      else
        {
         lasthigh=val;
         if((val-High[shift])&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer2[shift+back];
               if((res!=0)&amp;&amp;(res&lt;val)) ExtMapBuffer2[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer2[shift]=val;
     }

   // final cutting
   lasthigh=-1; lasthighpos=-1;
   lastlow=-1;  lastlowpos=-1;

   for(shift=Bars-ExtDepth; shift&gt;=0; shift--)
     {
      curlow=ExtMapBuffer[shift];
      curhigh=ExtMapBuffer2[shift];
      if((curlow==0)&amp;&amp;(curhigh==0)) continue;
      //---
      if(curhigh!=0)
        {
         if(lasthigh&gt;0)
           {
            if(lasthigh&lt;curhigh) ExtMapBuffer2[lasthighpos]=0;
            else ExtMapBuffer2[shift]=0;
           }
         //---
         if(lasthigh&lt;curhigh || lasthigh&lt;0)
           {
            lasthigh=curhigh;
            lasthighpos=shift;
           }
         lastlow=-1;
        }
      //----
      if(curlow!=0)
        {
         if(lastlow&gt;0)
           {
            if(lastlow&gt;curlow) ExtMapBuffer[lastlowpos]=0;
            else ExtMapBuffer[shift]=0;
           }
         //---
         if((curlow&lt;lastlow)||(lastlow&lt;0))
           {
            lastlow=curlow;
            lastlowpos=shift;
           }
         lasthigh=-1;
        }
     }

   for(shift=Bars-1; shift&gt;=0; shift--)
     {
      if(shift&gt;=Bars-ExtDepth) ExtMapBuffer[shift]=0.0;
      else
        {
         res=ExtMapBuffer2[shift];
         if(res!=0.0) ExtMapBuffer[shift]=res;
        }

     }

  	int i=0;
  	int LastZigZag, PreviousZigZag;

   /*
   for(int h=0; h&lt;Bars &amp;&amp; i&lt;=2; h++)
   {
      if (ExtMapBuffer[h]!=0) {
         i++;
         if (i==1) { LastZigZag=h;
      	} else { PreviousZigZag=h; }
      } else if (ExtMapBuffer2[h]!=0) {
         i++;
         if (i==1) { LastZigZag=h;
      	} else { PreviousZigZag=h; }
       }
   }
   */

   int h=0;
   while ( ExtMapBuffer[h]==0 &amp;&amp; ExtMapBuffer2[h]==0) {
   	h++;
   }

   LastZigZag=h;

   h++;
   while(ExtMapBuffer[h]==0 &amp;&amp; ExtMapBuffer2[h]==0) {
   	h++;
   }

   PreviousZigZag=h;

   ObjectCreate("Fibo", OBJ_FIBO, 0, Time[PreviousZigZag], ExtMapBuffer[LastZigZag], Time[LastZigZag], ExtMapBuffer[PreviousZigZag]);
  }</pre>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fforexdecode.com%2Fzigzag_fibo_v1betamq4%2F', 'ZigZag_Fibo_v1beta.mq4')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fforexdecode.com%2Fzigzag_fibo_v1betamq4%2F', title: '+ZigZag_Fibo_v1beta.mq4+' })"/></div><p align="left"><a class="tt" href="http://twitter.com/home/?status=ZigZag_Fibo_v1beta.mq4+http://xi6oz.th8.us" title="Post to Twitter"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a class="tt" href="http://twitter.com/home/?status=ZigZag_Fibo_v1beta.mq4+http://xi6oz.th8.us" title="Post to Twitter">Tweet This Post</a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zigzag_fibo_v1betamq4/&amp;title=ZigZag_Fibo_v1beta.mq4" title="Post to Delicious"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-delicious-big1.png" alt="[Post to Delicious]" border="0" /></a> <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zigzag_fibo_v1betamq4/&amp;title=ZigZag_Fibo_v1beta.mq4" title="Post to Delicious">Delicious This Post</a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZigZag_Fibo_v1beta.mq4&amp;link=http://forexdecode.com/zigzag_fibo_v1betamq4/" title="Post to Ping.fm"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-ping-big1.png" alt="[Post to Ping.fm]" border="0" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZigZag_Fibo_v1beta.mq4&amp;link=http://forexdecode.com/zigzag_fibo_v1betamq4/" title="Post to Ping.fm">Ping This Post</a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zigzag_fibo_v1betamq4/&amp;title=ZigZag_Fibo_v1beta.mq4" title="Post to StumbleUpon"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-su-big1.png" alt="[Post to StumbleUpon]" border="0" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zigzag_fibo_v1betamq4/&amp;title=ZigZag_Fibo_v1beta.mq4" title="Post to StumbleUpon">Stumble This Post</a>&nbsp; </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/forexdecode?a=ZrwAgCmCE7k:rmG6i7um4ts:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=ZrwAgCmCE7k:rmG6i7um4ts:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=ZrwAgCmCE7k:rmG6i7um4ts:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=ZrwAgCmCE7k:rmG6i7um4ts:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=ZrwAgCmCE7k:rmG6i7um4ts:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=ZrwAgCmCE7k:rmG6i7um4ts:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=ZrwAgCmCE7k:rmG6i7um4ts:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=ZrwAgCmCE7k:rmG6i7um4ts:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=ZrwAgCmCE7k:rmG6i7um4ts:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=ZrwAgCmCE7k:rmG6i7um4ts:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=ZrwAgCmCE7k:rmG6i7um4ts:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/forexdecode/~4/ZrwAgCmCE7k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forexdecode.com/zigzag_fibo_v1betamq4/feed/</wfw:commentRss>
		<feedburner:origLink>http://forexdecode.com/zigzag_fibo_v1betamq4/</feedburner:origLink></item>
		<item>
		<title>ZigZag1.mq4</title>
		<link>http://feedproxy.google.com/~r/forexdecode/~3/wvQ7kEBP6_I/</link>
		<comments>http://forexdecode.com/zigzag1mq4/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 16:51:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Metatrader Indicator Code]]></category>

		<category><![CDATA[Z]]></category>

		<category><![CDATA[ZigZag1.mq4]]></category>

		<guid isPermaLink="false">http://forexdecode.com/?p=994</guid>
		<description><![CDATA[//+------------------------------------------------------------------+
//&#124;                                        Custom Moving Average.mq4 &#124;
//&#124;            [...]]]></description>
			<content:encoded><![CDATA[<pre>//+------------------------------------------------------------------+
//|                                        Custom Moving Average.mq4 |
//|                      Copyright ?2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
//---- drawing settings
   SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtMapBuffer);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(0,0.0);
   ArraySetAsSeries(ExtMapBuffer,true);
   ArraySetAsSeries(ExtMapBuffer2,true);
//---- indicator short name
   IndicatorShortName("ZigZag("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    shift, back,lasthighpos,lastlowpos;
   double val,res;
   double curlow,curhigh,lasthigh,lastlow;

   for(shift=Bars-ExtDepth; shift&gt;=0; shift--)
     {
      val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)];
      if(val==lastlow) val=0.0;
      else
        {
         lastlow=val;
         if((Low[shift]-val)&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer[shift+back];
               if((res!=0)&amp;&amp;(res&gt;val)) ExtMapBuffer[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer[shift]=val;
      //--- high
      val=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)];
      if(val==lasthigh) val=0.0;
      else
        {
         lasthigh=val;
         if((val-High[shift])&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer2[shift+back];
               if((res!=0)&amp;&amp;(res&lt;val)) ExtMapBuffer2[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer2[shift]=val;
     }

   // final cutting
   lasthigh=-1; lasthighpos=-1;
   lastlow=-1;  lastlowpos=-1;

   for(shift=Bars-ExtDepth; shift&gt;=0; shift--)
     {
      curlow=ExtMapBuffer[shift];
      curhigh=ExtMapBuffer2[shift];
//      if((curlow==0.0)||(curhigh==0.0)) continue;
      //---
      if(curhigh!=0)
        {
         if(lasthigh&gt;0)
           {
            if(lasthigh&lt;curhigh) ExtMapBuffer2[lasthighpos]=0;
            else ExtMapBuffer2[shift]=0;
           };//?
         //---
         if(lasthigh&lt;curhigh || lasthigh&lt;0)
           {
            lasthigh=curhigh;
            lasthighpos=shift;
           };// ?
         lastlow=-1;
        };//?
      //----
      if(curlow!=0)
        {
         if(lastlow&gt;0)
           {
            if(lastlow&gt;curlow) ExtMapBuffer[lastlowpos]=0;
            else ExtMapBuffer[shift]=0;
           };//z
         //---
         if((curlow&lt;lastlow)||(lastlow&lt;0))
           {
            lastlow=curlow;
            lastlowpos=shift;
           };//z
         lasthigh=-1;
        };//
     }

   for(shift=Bars-1; shift&gt;=0; shift--)
     {
      if(shift&gt;=Bars-ExtDepth) ExtMapBuffer[shift]=0.0;
      else
        {
         res=ExtMapBuffer2[shift];
         if(res!=0.0) ExtMapBuffer[shift]=res;
         //if(res&gt;0.0) ExtMapBuffer[shift]=res;
        }
     }
  }</pre>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fforexdecode.com%2Fzigzag1mq4%2F', 'ZigZag1.mq4')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fforexdecode.com%2Fzigzag1mq4%2F', title: '+ZigZag1.mq4+' })"/></div><p align="left"><a class="tt" href="http://twitter.com/home/?status=ZigZag1.mq4+http://gmr43.th8.us" title="Post to Twitter"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a class="tt" href="http://twitter.com/home/?status=ZigZag1.mq4+http://gmr43.th8.us" title="Post to Twitter">Tweet This Post</a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zigzag1mq4/&amp;title=ZigZag1.mq4" title="Post to Delicious"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-delicious-big1.png" alt="[Post to Delicious]" border="0" /></a> <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zigzag1mq4/&amp;title=ZigZag1.mq4" title="Post to Delicious">Delicious This Post</a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZigZag1.mq4&amp;link=http://forexdecode.com/zigzag1mq4/" title="Post to Ping.fm"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-ping-big1.png" alt="[Post to Ping.fm]" border="0" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZigZag1.mq4&amp;link=http://forexdecode.com/zigzag1mq4/" title="Post to Ping.fm">Ping This Post</a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zigzag1mq4/&amp;title=ZigZag1.mq4" title="Post to StumbleUpon"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-su-big1.png" alt="[Post to StumbleUpon]" border="0" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zigzag1mq4/&amp;title=ZigZag1.mq4" title="Post to StumbleUpon">Stumble This Post</a>&nbsp; </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/forexdecode?a=wvQ7kEBP6_I:_zYGz3TEWbM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=wvQ7kEBP6_I:_zYGz3TEWbM:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=wvQ7kEBP6_I:_zYGz3TEWbM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=wvQ7kEBP6_I:_zYGz3TEWbM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=wvQ7kEBP6_I:_zYGz3TEWbM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=wvQ7kEBP6_I:_zYGz3TEWbM:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=wvQ7kEBP6_I:_zYGz3TEWbM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=wvQ7kEBP6_I:_zYGz3TEWbM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=wvQ7kEBP6_I:_zYGz3TEWbM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=wvQ7kEBP6_I:_zYGz3TEWbM:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=wvQ7kEBP6_I:_zYGz3TEWbM:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/forexdecode/~4/wvQ7kEBP6_I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forexdecode.com/zigzag1mq4/feed/</wfw:commentRss>
		<feedburner:origLink>http://forexdecode.com/zigzag1mq4/</feedburner:origLink></item>
		<item>
		<title>ZigZag.mq4</title>
		<link>http://feedproxy.google.com/~r/forexdecode/~3/E251JU_xyrg/</link>
		<comments>http://forexdecode.com/zigzagmq4/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 16:50:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Metatrader Indicator Code]]></category>

		<category><![CDATA[Z]]></category>

		<category><![CDATA[ZigZag.mq4]]></category>

		<guid isPermaLink="false">http://forexdecode.com/?p=993</guid>
		<description><![CDATA[//+------------------------------------------------------------------+
//&#124;                                        Custom Moving Average.mq4 &#124;
//&#124;            [...]]]></description>
			<content:encoded><![CDATA[<pre>//+------------------------------------------------------------------+
//|                                        Custom Moving Average.mq4 |
//|                      Copyright ?2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
//---- drawing settings
   SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtMapBuffer);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(0,0.0);
   ArraySetAsSeries(ExtMapBuffer,true);
   ArraySetAsSeries(ExtMapBuffer2,true);
//---- indicator short name
   IndicatorShortName("ZigZag("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    shift, back,lasthighpos,lastlowpos;
   double val,res;
   double curlow,curhigh,lasthigh,lastlow;

   for(shift=Bars-ExtDepth; shift&gt;=0; shift--)
     {
      val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)];
      if(val==lastlow) val=0.0;
      else
        {
         lastlow=val;
         if((Low[shift]-val)&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer[shift+back];
               if((res!=0)&amp;&amp;(res&gt;val)) ExtMapBuffer[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer[shift]=val;
      //--- high
      val=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)];
      if(val==lasthigh) val=0.0;
      else
        {
         lasthigh=val;
         if((val-High[shift])&gt;(ExtDeviation*Point)) val=0.0;
         else
           {
            for(back=1; back&lt;=ExtBackstep; back++)
              {
               res=ExtMapBuffer2[shift+back];
               if((res!=0)&amp;&amp;(res&lt;val)) ExtMapBuffer2[shift+back]=0.0;
              }
           }
        }
      ExtMapBuffer2[shift]=val;
     }

   // final cutting
   lasthigh=-1; lasthighpos=-1;
   lastlow=-1;  lastlowpos=-1;

   for(shift=Bars-ExtDepth; shift&gt;=0; shift--)
     {
      curlow=ExtMapBuffer[shift];
      curhigh=ExtMapBuffer2[shift];
      if((curlow==0)&amp;&amp;(curhigh==0)) continue;
      //---
      if(curhigh!=0)
        {
         if(lasthigh&gt;0)
           {
            if(lasthigh&lt;curhigh) ExtMapBuffer2[lasthighpos]=0;
            else ExtMapBuffer2[shift]=0;
           }
         //---
         if(lasthigh&lt;curhigh || lasthigh&lt;0)
           {
            lasthigh=curhigh;
            lasthighpos=shift;
           }
         lastlow=-1;
        }
      //----
      if(curlow!=0)
        {
         if(lastlow&gt;0)
           {
            if(lastlow&gt;curlow) ExtMapBuffer[lastlowpos]=0;
            else ExtMapBuffer[shift]=0;
           }
         //---
         if((curlow&lt;lastlow)||(lastlow&lt;0))
           {
            lastlow=curlow;
            lastlowpos=shift;
           }
         lasthigh=-1;
        }
     }

   for(shift=Bars-1; shift&gt;=0; shift--)
     {
      if(shift&gt;=Bars-ExtDepth) ExtMapBuffer[shift]=0.0;
      else
        {
         res=ExtMapBuffer2[shift];
         if(res!=0.0) ExtMapBuffer[shift]=res;
        }
     }
  }</pre>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fforexdecode.com%2Fzigzagmq4%2F', 'ZigZag.mq4')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fforexdecode.com%2Fzigzagmq4%2F', title: '+ZigZag.mq4+' })"/></div><p align="left"><a class="tt" href="http://twitter.com/home/?status=ZigZag.mq4+http://4bqrh.th8.us" title="Post to Twitter"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a class="tt" href="http://twitter.com/home/?status=ZigZag.mq4+http://4bqrh.th8.us" title="Post to Twitter">Tweet This Post</a>&nbsp; <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zigzagmq4/&amp;title=ZigZag.mq4" title="Post to Delicious"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-delicious-big1.png" alt="[Post to Delicious]" border="0" /></a> <a class="tt" href="http://delicious.com/post?url=http://forexdecode.com/zigzagmq4/&amp;title=ZigZag.mq4" title="Post to Delicious">Delicious This Post</a>&nbsp; <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZigZag.mq4&amp;link=http://forexdecode.com/zigzagmq4/" title="Post to Ping.fm"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-ping-big1.png" alt="[Post to Ping.fm]" border="0" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=ZigZag.mq4&amp;link=http://forexdecode.com/zigzagmq4/" title="Post to Ping.fm">Ping This Post</a>&nbsp; <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zigzagmq4/&amp;title=ZigZag.mq4" title="Post to StumbleUpon"><img class="nothumb" src="http://forexdecode.com/wp-content/plugins/tweet-this/icons/tt-su-big1.png" alt="[Post to StumbleUpon]" border="0" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://forexdecode.com/zigzagmq4/&amp;title=ZigZag.mq4" title="Post to StumbleUpon">Stumble This Post</a>&nbsp; </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/forexdecode?a=E251JU_xyrg:QrQoEFkHBpU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=E251JU_xyrg:QrQoEFkHBpU:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=E251JU_xyrg:QrQoEFkHBpU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=E251JU_xyrg:QrQoEFkHBpU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=E251JU_xyrg:QrQoEFkHBpU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=E251JU_xyrg:QrQoEFkHBpU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=E251JU_xyrg:QrQoEFkHBpU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=E251JU_xyrg:QrQoEFkHBpU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=E251JU_xyrg:QrQoEFkHBpU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/forexdecode?i=E251JU_xyrg:QrQoEFkHBpU:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/forexdecode?a=E251JU_xyrg:QrQoEFkHBpU:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/forexdecode?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/forexdecode/~4/E251JU_xyrg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forexdecode.com/zigzagmq4/feed/</wfw:commentRss>
		<feedburner:origLink>http://forexdecode.com/zigzagmq4/</feedburner:origLink></item>
	</channel>
</rss>
