Golden_section_v2(4)





//+------------------------------------------------------------------+
//|                                            Golden_section_v2.mq4 |
//|                                                            Talex |
//|                                                 tan@gazinter.net |
//+------------------------------------------------------------------+
#property copyright "Talex"
#property link      "tan@gazinter.net"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Lime

extern int ExtDepth=8; /* ïàðàìåòð äëÿ ZZ */
/*extern*/ int ExtIndicator=0; /* îïðåäåëÿåò èíäèêòîð, êîòîðûé áóäåò èñêàòü òî÷êè äëÿ ïîñòðîåíèÿ ïàòòåðíà, ïîêà òîëüêî 0 */
extern double ExtDopusk=0.01; /* ïàðàìåòðû ïàòòåðíà áóäóò îòëè÷àòüñÿ íå áîëåå ÷åì âåëè÷èíà ExtDopusk */
extern int ExtPoint=3; /* ÷èñëî ñ÷èòàåìûõ òî÷åê ïåðåëîìà, åñëè ñäåëàòü áîëüøå 3, òî âîçìîæíî ñòðîèòü îò ëþáîé òî÷êè ïåðåëîìà */
extern string ExtComplect="0"; /* ýòî äëÿ òîãî,÷òîáû âûâîäèòü íåñêîëüêî èíäèêàòîðîâ íà ãðàôèêå */
extern int ExtMovePoint=0; /*ïåðåìåñòèòü òî÷êó îòðèñîâêè âååðà îò âèë íà êîëè÷åñòâî áàðîâ óêàçàííîå ïåðåìåííîé */
extern bool ExtPitchfork=true; /* èñïîëüçóåòñÿ ïîñòðîåíèå ñ ïîìîùüþ âèë */
extern bool ExtPitchforkRevers=false; /* ïåðåâîðà÷èâàåò âåíèê, çà÷åì? ñïðîñèòå Vadimcha */
extern bool ExtBack=true; /* åñëè true, òî îáúåêòû áóäóò ïîêàçàíû â ôîíîâîì ðåæèìå */
extern bool ExtFan=true; /* åñëè true, òî ôèáîâåíèê áóäåò âûâåäåí íà ãðàôèê */
extern bool ExtRec=true; /* åñëè true, òî ïðÿìîóãîëüíèê áóäåò âûâåäåí íà ãðàôèê */
extern bool ExtArc=true; /* åñëè true, òî ôèáîàðêà áóäåò âûâåäåíà íà ãðàôèê */
extern bool ExtLeftChannel=false; /* åñëè true, òî ëèíèè êàíàëà áóäóò âûâåäåíû íà ãðàôèê */
extern bool ExtRightChannel=false; /* åñëè true, òî ëèíèè êàíàëà áóäóò âûâåäåíû íà ãðàôèê */
extern double ExtFiboLeftChannel=1.618; /* óñòàíàâëèâàåò ôèáî òî÷êó ïîñòðîåíèÿ ëåâûõ ëèíèé */
extern double ExtFiboRightChannel=1.618; /* óñòàíàâëèâàåò ôèáî òî÷êó ïîñòðîåíèÿ ïðàâûõ ëèíèé */
extern bool ExtSave=false; /* åñëè true, òî ïîñòðîåíèÿ áóäóò ñîõðàíåíû íà ãðàôèêå */
extern double ExtScale=0; /* óñòàíàâëèâàåò ìàñøòàá äóãè */
extern int ExtFanStyle=0; /* óñòàíàâëèâàåò ñòèëü ëèíèé ôèáîâåíèêà */
extern int ExtFanWidth=1; /* óñòàíàâëèâàåò øèðèíó ëèíèé ôèáîâåíèêà */
extern color ExtFanColor=DeepPink; /* öâåò ôèáîâåíèêîâ */
extern int ExtRecStyle=4; /* óñòàíàâëèâàåò ñòèëü ëèíèé ïðÿìîóãîëüíèêà */
extern int ExtRecWidth=1; /* óñòàíàâëèâàåò øèðèíó ëèíèé ïðÿìîóãîëüíèêà */
extern color ExtRecColor=Yellow; /* öâåò ïðÿìîóãîëüíèêà */
extern int ExtArcStyle=0; /* óñòàíàâëèâàåò ñòèëü ëèíèé ôèáîàðêè */ 
extern int ExtArcWidth=1; /* óñòàíàâëèâàåò øèðèíó ëèíèé ôèáîàðêè */
extern color ExtArcColor=Red; /* öâåò äóãè */
extern int ExtChannelStyle=0; /* óñòàíàâëèâàåò ñòèëü ëèíèé êàíàëà */ 
extern int ExtChannelWidth=1; /* óñòàíàâëèâàåò øèðèíó ëèíèé êàíàëà */ 
extern color ExtChannelColor=Blue; /* öâåò ëèíèé êàíàëà */
extern int ExtPitchforkStyle=0; /* óñòàíàâëèâàåò ñòèëü ëèíèé âèë */
extern int ExtPitchforkWidth=1; /* óñòàíàâëèâàåò øèðèíó ëèíèé âèë */
extern color ExtPitchforkColor=Lime; /* öâåò âèë */
/* Íèæå êîîðäèíàòû òî÷åê ìîæíî ââîäèòü ðó÷êàìè */
extern datetime TimePointX=0; /* âðåìÿ òî÷êè X â ôîðìàòå '1980.07.19 12:30' */
extern datetime TimePointA=0; /* âðåìÿ òî÷êè A â ôîðìàòå '1980.07.19 12:30' */
extern datetime TimePointB=0; /* âðåìÿ òî÷êè B â ôîðìàòå '1980.07.19 12:30' */

extern double FiboFanMediana1=0.382;
extern double FiboFanMediana2=1.272;

extern double Fibo1=0.0;
extern double Fibo2=0.382;
extern double Fibo3=0.5;
extern double Fibo4=0.618;
extern double Fibo5=0.786;
extern double Fibo6=0.886;
extern double Fibo7=1.0;
extern double Fibo8=1.272;
extern double Fibo9=1.618;
extern double Fibo10=2.0;
extern double Fibo11=2.618;

/* Ñîâåò - íàñòðîéòå äëÿ ñåáÿ öâåò, ñòèëü, øèðèíó ëèíèé îáúåêòîâ, ôèáî-óðîâíè è óáåðèòå ïåðåä ñîîòâåòñòâóþùèìè ïàðàìåòðàìè extern */


double zz[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(1);
   SetIndexBuffer(0,zz);
   SetIndexStyle(0,DRAW_SECTION);
   SetIndexEmptyValue(0,0.0);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   int i;
   
    for(i=0;i<=ExtDepth;i++)
    {
    ObjectDelete("FiboFan1"+"_"+i+"_"+ExtComplect+"_");
    ObjectDelete("FiboFan2"+"_"+i+"_"+ExtComplect+"_");
    ObjectDelete("FiboArc"+"_"+i+"_"+ExtComplect+"_");
    ObjectDelete("Rectangle"+"_"+i+"_"+ExtComplect+"_");
    ObjectDelete("LeftChannel"+"_"+i+"_"+ExtComplect+"_");
    ObjectDelete("RightChannel"+"_"+i+"_"+ExtComplect+"_");
    ObjectDelete("LeftLine"+"_"+i+"_"+ExtComplect+"_");
    ObjectDelete("RightLine"+"_"+i+"_"+ExtComplect+"_");
    ObjectDelete("Pitchfork"+"_"+i+"_"+ExtComplect+"_");
    ObjectDelete("Mediana"+"_"+i+"_"+ExtComplect+"_");
    }
    
   //----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int PP[];
   int i,j,X,A,B;
   double R0382=0.382, R0786=0.786, retXB, minret, maxret,AutoScale;
   double p1,p2,p3,p4,p5,p6,p7;
   datetime t1,t2,t3,t4,t5,t6,t7;
   string save="";
   double tang;
   
   if(ExtSave==true)
   {
    save=TimeToStr(TimeLocal(),TIME_DATE|TIME_SECONDS);
   }
   minret=1-ExtDopusk; maxret=1+ExtDopusk;
   
   ArrayResize(PP,ExtPoint); 
   
   if(TimePointX!=0 && TimePointA!=0 && TimePointB!=0)
   {
    ExtPoint=3;
    PP[0]=iBarShift(NULL,0,TimePointB); 
    PP[1]=iBarShift(NULL,0,TimePointA);
    PP[2]=iBarShift(NULL,0,TimePointX);
    if((High[PP[0]]>High[PP[1]] && High[PP[2]]>High[PP[1]]) || (Low[PP[0]]>Low[PP[1]] && Low[PP[2]]>Low[PP[1]]))
    {
     zz[PP[0]]=High[PP[0]];
     zz[PP[1]]=Low[PP[1]];
     zz[PP[2]]=High[PP[2]];
    }else 
     {
      zz[PP[0]]=Low[PP[0]];
      zz[PP[1]]=High[PP[1]];
      zz[PP[2]]=Low[PP[2]];
     }
   } else
   {
   switch (ExtIndicator)
     {
      case 0: {ZZTalex(ExtDepth);   break;}
      /* çäåñü ìîæíî äîáàâëÿòü ôóíêöèè ïî ðàñ÷åòó òî÷åê ïàòòåðíîâ */
      default:{ZZTalex(ExtDepth);   break;}
     }
     if(ExtIndicator==0)
     { 
      j=0;
      for(i=0;i<Bars-1 && j<=ExtPoint;i++)
      {
       if(zz[i]!=0)
       {
        PP[j]=i;
        j++;
       }
      }
     }
    }
    if(ExtPitchfork==false)
    {
     if((zz[PP[ExtPoint-1]]<zz[PP[ExtPoint-3]] && zz[PP[ExtPoint-3]]<zz[PP[ExtPoint-2]]) || (zz[PP[ExtPoint-1]]>zz[PP[ExtPoint-3]] && zz[PP[ExtPoint-3]]>zz[PP[ExtPoint-2]]))
     {
      retXB=(zz[PP[ExtPoint-2]]-zz[PP[ExtPoint-3]])/(zz[PP[ExtPoint-2]]-zz[PP[ExtPoint-1]]+0.000001);
      
      if(retXB>=R0382*minret && retXB<=R0786*maxret)
      {
       t1=Time[PP[ExtPoint-1]];p1=zz[PP[ExtPoint-1]];
       t2=Time[PP[ExtPoint-3]];p2=zz[PP[ExtPoint-3]];
       if(2*PP[ExtPoint-3]-PP[ExtPoint-1]<=0)
       {
        t3=Time[0]-(2*PP[ExtPoint-3]-PP[ExtPoint-1])*Period()*60;p3=zz[PP[ExtPoint-3]]-(zz[PP[ExtPoint-1]]-zz[PP[ExtPoint-3]]);
       } else {t3=Time[2*PP[ExtPoint-3]-PP[ExtPoint-1]];p3=zz[PP[ExtPoint-3]]-(zz[PP[ExtPoint-1]]-zz[PP[ExtPoint-3]]);}
      }
     }
     if(ExtScale==0)
     {/* ðàñ÷åò AutoScale ïðåäëîæèë Vadimcha ê íåìó âñå âîïðîñû */
      AutoScale=MathAbs((p1-p3)*MathPow(10,Digits)/(2*(PP[ExtPoint-1]-PP[ExtPoint-3])));
     }else AutoScale=ExtScale;
     CreateObject(p1,p2,p3,t1,t2,t3,save,AutoScale);
    }
    if(ExtPitchfork)
   {
    t1=Time[PP[ExtPoint-1]];p1=zz[PP[ExtPoint-1]];
    t2=Time[PP[ExtPoint-2]];p2=zz[PP[ExtPoint-2]];
    t3=Time[PP[ExtPoint-3]];p3=zz[PP[ExtPoint-3]];
    p4=(zz[PP[ExtPoint-2]]+zz[PP[ExtPoint-3]])/2;
    ObjectCreate("Pitchfork"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_PITCHFORK,0,t1,p1,t2,p2,t3,p3);
    ObjectSet("Pitchfork"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_BACK,ExtBack);
    ObjectSet("Pitchfork"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_COLOR,ExtPitchforkColor);
    ObjectSet("Pitchfork"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_STYLE,ExtPitchforkStyle);
    ObjectSet("Pitchfork"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_WIDTH,ExtPitchforkWidth);
       
    tang=(p1-p4)/(PP[ExtPoint-1]-(PP[ExtPoint-2]-(PP[ExtPoint-2]-PP[ExtPoint-3])/2.0));
    t5=t3;
    p5=p1-tang*(PP[ExtPoint-1]-PP[ExtPoint-3]);
    ObjectCreate("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_TREND,0,t1,p1,t5,p5);
    ObjectSet("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_BACK,ExtBack);
    ObjectSet("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_COLOR,ExtPitchforkColor);
    
    if((p1<p2 && p1<p4) || (p1>p2 && p1>p4))
     {
      /* â ýòîì ñëó÷àå ñîâïàäóò óðîâíè ìåíåå 100% */
      
       p6=(p5-p3)/FiboFanMediana1+p3;//-tang*ExtMovePoint;
       if(ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6)<-100)
        {
         Alert("Òî÷êà äëÿ ïîñòðîåíèÿ âååðà íàõîäèòüñÿ ñëèøêîì äàëåêî, ïîïðîáóéòå èñïîëüçîâàòü áîëüøåå çíà÷åíèå äëÿ FiboFanMediana1");
        }
      
       if(ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6)>0)
       {
        t6=Time[ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6)]+ExtMovePoint*Period()*60;
       } else t6=Time[0]-ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6)*Period()*60+ExtMovePoint*Period()*60;
     }
     if((p1<p2 && p1>p4) || (p1>p2 && p1<p4))
     {
      /* â ýòîì ñëó÷àå ñîâïàäóò óðîâíè áîëåå 100% */
      
       p6=(p5-p3)/FiboFanMediana2+p3;//-tang*ExtMovePoint;
       if(ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6)<-100)
        {
         Alert("Òî÷êà äëÿ ïîñòðîåíèÿ âååðà íàõîäèòüñÿ ñëèøêîì äàëåêî, ïîïðîáóéòå èñïîëüçîâàòü ìåíüøåå çíà÷åíèå äëÿ FiboFanMediana2");
        }
     
       if(ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6)-ExtMovePoint>=0)
       {
        t6=Time[ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6)]+ExtMovePoint*Period()*60;
       } else t6=Time[0]-ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6)*Period()*60+ExtMovePoint*Period()*60;
     }
     if(2*ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6)-PP[ExtPoint-3]-2*ExtMovePoint>=0)
     {
      t7=Time[2*ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6)-PP[ExtPoint-3]-2*ExtMovePoint];
     }
      else t7=t6+(PP[ExtPoint-3]-ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6))*Period()*60+ExtMovePoint*Period()*60;
     /* êîððåêöèÿ öåíû p6 */
     p6=ObjectGetValueByShift("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6));
     p7=2*p6-p3;
     //Print("t6=",TimeToStr(t6,TIME_DATE),"; p6=",p6,"; NbarMediana=",ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6));
     //Print("t3=",TimeToStr(t3,TIME_DATE),"; p3=",p3,"; t7=",TimeToStr(t7,TIME_DATE),"; p7=",p7);
     if(p1==p4)
     {
      Alert("Âååð ïîñòðîèòü íåëüçÿ.");
      p3=0;p6=0;p7=0;t3=0;t6=0;t7=0;
     }
     if(ExtScale==0)
     {
      AutoScale=MathAbs((p7-p3)*MathPow(10,Digits)/(2*(PP[ExtPoint-3]-ObjectGetShiftByValue("Mediana"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,p6))));
     }else AutoScale=ExtScale;
    CreateObject(p3,p6,p7,t3,t6,t7,save,AutoScale);
     
   }
   
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

/*------------------------------------------------------------------+
|  ZigZag_Talex, èùåò òî÷êè ïåðåëîìà íà ãðàôèêå. Êîëè÷åñòâî òî÷åê   |
|  çàäàåòñÿ âíåøíèì ïàðàìåòðîì ExtPoint.                            |
+------------------------------------------------------------------*/
void ZZTalex(int n)
{
/*ïåðåìåííûå*/
   int    i,j,k,zzbarlow,zzbarhigh,curbar,curbar1,curbar2,EP,Mbar[];
   double curpr,Mprice[];
   bool flag,fd;
   static int endbar;
   static double endpr;
   
   
   /*íà÷àëî*/
   
   for(i=0;i<=Bars-1;i++)
   {zz[i]=0.0;}
   
   EP=ExtPoint;
   zzbarlow=iLowest(NULL,0,MODE_LOW,n,0);        
   zzbarhigh=iHighest(NULL,0,MODE_HIGH,n,0);     
   
   if(zzbarlow<zzbarhigh) {curbar=zzbarlow; curpr=Low[zzbarlow];}
   if(zzbarlow>zzbarhigh) {curbar=zzbarhigh; curpr=High[zzbarhigh];}
   if(zzbarlow==zzbarhigh){curbar=zzbarlow;curpr=funk1(zzbarlow, n);}
   
   ArrayResize(Mbar,ExtPoint);
   ArrayResize(Mprice,ExtPoint);
   j=0;
   endpr=curpr;
   endbar=curbar;
   Mbar[j]=curbar;
   Mprice[j]=curpr;
   
   EP--;
   if(curpr==Low[curbar]) flag=true;
   else flag=false;
    
   i=curbar+1;
   while(EP>0)
   {
    if(flag)
    {
     while(i<=Bars-1)
     {
     curbar1=iHighest(NULL,0,MODE_HIGH,n,i); 
     curbar2=iHighest(NULL,0,MODE_HIGH,n,curbar1); 
     if(curbar1==curbar2){curbar=curbar1;curpr=High[curbar];flag=false;i=curbar+1;j++;break;}
     else i=curbar2;
     }
     
     Mbar[j]=curbar;
     Mprice[j]=curpr;
     EP--;
     
    }
    
    if(EP==0) break;
    
    if(!flag) 
    {
     while(i<=Bars-1)
     {
     curbar1=iLowest(NULL,0,MODE_LOW,n,i); 
     curbar2=iLowest(NULL,0,MODE_LOW,n,curbar1); 
     if(curbar1==curbar2){curbar=curbar1;curpr=Low[curbar];flag=true;i=curbar+1;j++;break;}
     else i=curbar2;
     }
     
     Mbar[j]=curbar;
     Mprice[j]=curpr;
     EP--;
    }
   }
   /* èñïðàâëåíèå âåðøèí */
   if(Mprice[0]==Low[Mbar[0]])fd=true; else fd=false;
   for(k=0;k<=ExtPoint-1;k++)
   {
    if(k==0)
    {
     if(fd==true)
      {
       Mbar[k]=iLowest(NULL,0,MODE_LOW,Mbar[k+1]-Mbar[k],Mbar[k]);Mprice[k]=Low[Mbar[k]];endbar=ExtDepth;
      }
     if(fd==false)
      {
       Mbar[k]=iHighest(NULL,0,MODE_HIGH,Mbar[k+1]-Mbar[k],Mbar[k]);Mprice[k]=High[Mbar[k]];endbar=ExtDepth;
      }
    }
    if(k<ExtPoint-2)
    {
     if(fd==true)
      {
       Mbar[k+1]=iHighest(NULL,0,MODE_HIGH,Mbar[k+2]-Mbar[k]-1,Mbar[k]+1);Mprice[k+1]=High[Mbar[k+1]];
      }
     if(fd==false)
      {
       Mbar[k+1]=iLowest(NULL,0,MODE_LOW,Mbar[k+2]-Mbar[k]-1,Mbar[k]+1);Mprice[k+1]=Low[Mbar[k+1]];
      }
    }
    if(fd==true)fd=false;else fd=true;
    
    /* ïîñòðîéêà ZigZag'a */
    zz[Mbar[k]]=Mprice[k];
    //Print("zz_"+k,"=",zz[Mbar[k]]);
   }
  
 } 
/*-------------------------------------------------------------------+
/  ZigZag_Talex êîíåö                                                |
/-------------------------------------------------------------------*/

/*-------------------------------------------------------------------+
/ Ôóíöèÿ äëÿ ïîèñêà ó ïåðâîãî áàðà (åñëè îí âíåøíèé) êàêîé ýêñòðåìóì |
/ áóäåì èñïîëüçîâàòü â êà÷åñòâå âåðøèíû.                             |
/-------------------------------------------------------------------*/
double funk1(int zzbarlow, int ExtDepth)
{
 double pr;
 int fbarlow,fbarhigh;
 
 fbarlow=iLowest(NULL,0,MODE_LOW,ExtDepth,zzbarlow);  
 fbarhigh=iHighest(NULL,0,MODE_HIGH,ExtDepth,zzbarlow);
 
 if(fbarlow>fbarhigh) {/*if((Low[zzbarlow]<Low[fbarhigh]) && (High[zzbarlow]<High[fbarhigh]))*/ pr=High[zzbarlow];}
 if(fbarlow<fbarhigh) {/*if((Low[zzbarlow]>Low[fbarlow]) && (High[zzbarlow]>High[fbarlow]))*/ pr=Low[zzbarlow];}
 if(fbarlow==fbarhigh)
 {
  fbarlow=iLowest(NULL,0,MODE_LOW,2*ExtDepth,zzbarlow);  
  fbarhigh=iHighest(NULL,0,MODE_HIGH,2*ExtDepth,zzbarlow);
  if(fbarlow>fbarhigh) {/*if((Low[zzbarlow]<Low[fbarhigh]) && (High[zzbarlow]<High[fbarhigh]))*/ pr=High[zzbarlow];}
  if(fbarlow<fbarhigh) {/*if((Low[zzbarlow]>Low[fbarlow]) && (High[zzbarlow]>High[fbarlow]))*/ pr=Low[zzbarlow];}
  if(fbarlow==fbarhigh)
  {
   fbarlow=iLowest(NULL,0,MODE_LOW,3*ExtDepth,zzbarlow);  
   fbarhigh=iHighest(NULL,0,MODE_HIGH,3*ExtDepth,zzbarlow);
   if(fbarlow>fbarhigh) {/*if((Low[zzbarlow]<Low[fbarhigh]) && (High[zzbarlow]<High[fbarhigh]))*/ pr=High[zzbarlow];}
   if(fbarlow<fbarhigh) {/*if((Low[zzbarlow]>Low[fbarlow]) && (High[zzbarlow]>High[fbarlow]))*/ pr=Low[zzbarlow];}
  }
 }
 return(pr);
}
/*----------------------------------------------------------------------------*/

/*------------------------------------------------------------------+
|                 Ôóíêöèÿ ñîçäàíèÿ îáúåêòîâ                         |
+------------------------------------------------------------------*/
void CreateObject(double p1, double p2, double p3, datetime t1, datetime t2, datetime t3,string save,double AutoScale)
{
 if(ExtFan)
     { 
       ObjectCreate("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_FIBOFAN,0,t2,p2,t1,p1);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_BACK,ExtBack);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIBOLEVELS,11);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELCOLOR,ExtFanColor);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELSTYLE,ExtFanStyle);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELWIDTH,ExtFanWidth);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+0,Fibo1);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+1,Fibo2);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+2,Fibo3);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+3,Fibo4);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+4,Fibo5);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+5,Fibo6);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+6,Fibo7);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+7,Fibo8);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+8,Fibo9);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+9,Fibo10);
       ObjectSet("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+10,Fibo11);
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,0,DoubleToStr(Fibo1*100,1));
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,1,DoubleToStr(Fibo2*100,1));
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,2,DoubleToStr(Fibo3*100,1));
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,3,DoubleToStr(Fibo4*100,1));
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,4,DoubleToStr(Fibo5*100,1));
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,5,DoubleToStr(Fibo6*100,1));
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,6,DoubleToStr(Fibo7*100,1));
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,7,DoubleToStr(Fibo8*100,1));
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,8,DoubleToStr(Fibo9*100,1));
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,9,DoubleToStr(Fibo10*100,1));
       ObjectSetFiboDescription("FiboFan1"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,10,DoubleToStr(Fibo11*100,1));
       if(ExtPitchforkRevers==false)
       ObjectCreate("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_FIBOFAN,0,t2,p2,t3,p3);
       else ObjectCreate("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_FIBOFAN,0,t2,p2,t3,2*p2-p3);
      
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_BACK,ExtBack);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIBOLEVELS,11);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELCOLOR,ExtFanColor);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELSTYLE,ExtFanStyle);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELWIDTH,ExtFanWidth);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+0,Fibo1);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+1,Fibo2);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+2,Fibo3);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+3,Fibo4);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+4,Fibo5);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+5,Fibo6);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+6,Fibo7);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+7,Fibo8);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+8,Fibo9);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+9,Fibo10);
       ObjectSet("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+10,Fibo11);
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,0,DoubleToStr(Fibo1*100,1));
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,1,DoubleToStr(Fibo2*100,1));
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,2,DoubleToStr(Fibo3*100,1));
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,3,DoubleToStr(Fibo4*100,1));
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,4,DoubleToStr(Fibo5*100,1));
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,5,DoubleToStr(Fibo6*100,1));
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,6,DoubleToStr(Fibo7*100,1));
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,7,DoubleToStr(Fibo8*100,1));
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,8,DoubleToStr(Fibo9*100,1));
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,9,DoubleToStr(Fibo10*100,1));
       ObjectSetFiboDescription("FiboFan2"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,10,DoubleToStr(Fibo11*100,1));
       }
       if(ExtRec)
       {
       ObjectCreate("Rectangle"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_RECTANGLE,0,t1,p1,t3,p3);
       ObjectSet("Rectangle"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_BACK,ExtBack);
       ObjectSet("Rectangle"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_COLOR,ExtRecColor);
       ObjectSet("Rectangle"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_STYLE,ExtRecStyle);
       ObjectSet("Rectangle"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_WIDTH,ExtRecWidth);
       ObjectSet("Rectangle"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_BACK,false);
       }
       if(ExtArc)
       {
       ObjectCreate("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_FIBOARC,0,t2,p1,t2,p2);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_BACK,ExtBack);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_ELLIPSE,true);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_SCALE,AutoScale);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIBOLEVELS,11);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELCOLOR,ExtArcColor);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELSTYLE,ExtArcStyle);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELWIDTH,ExtArcWidth);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+0,Fibo1);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+1,Fibo2);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+2,Fibo3);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+3,Fibo4);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+4,Fibo5);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+5,Fibo6);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+6,Fibo7);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+7,Fibo8);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+8,Fibo9);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+9,Fibo10);
       ObjectSet("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+10,Fibo11);
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,0,DoubleToStr(Fibo1*100,1));
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,1,DoubleToStr(Fibo2*100,1));
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,2,DoubleToStr(Fibo3*100,1));
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,3,DoubleToStr(Fibo4*100,1));
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,4,DoubleToStr(Fibo5*100,1));
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,5,DoubleToStr(Fibo6*100,1));
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,6,DoubleToStr(Fibo7*100,1));
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,7,DoubleToStr(Fibo8*100,1));
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,8,DoubleToStr(Fibo9*100,1));
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,9,DoubleToStr(Fibo10*100,1));
       ObjectSetFiboDescription("FiboArc"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,10,DoubleToStr(Fibo11*100,1));
       }
       if(ExtLeftChannel)
       {
        ObjectCreate("LeftLine"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_TREND,0,t2,p2,t3,p1+(p2-p1)*(2-ExtFiboLeftChannel));
        ObjectSet("LeftLine"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_BACK,ExtBack);
        ObjectSet("LeftLine"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_COLOR,ExtChannelColor);
        ObjectSet("LeftLine"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_STYLE,ExtChannelStyle);
        ObjectSet("LeftLine"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_WIDTH,ExtChannelWidth);
        ObjectCreate("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_FIBOCHANNEL,0,t2,p2,t1,p1+(p2-p1)*ExtFiboLeftChannel,t2,p1);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_COLOR,ExtChannelColor);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_STYLE,ExtChannelStyle);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_WIDTH,ExtChannelWidth);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIBOLEVELS,21);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELCOLOR,ExtChannelColor);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELSTYLE,ExtChannelStyle);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELWIDTH,ExtChannelWidth);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+0,Fibo1);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+1,Fibo2);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+2,Fibo3);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+3,Fibo4);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+4,Fibo5);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+5,Fibo6);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+6,Fibo7);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+7,Fibo8);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+8,Fibo9);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+9,Fibo10);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+10,Fibo11);
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,0,DoubleToStr(Fibo1*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,1,DoubleToStr(Fibo2*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,2,DoubleToStr(Fibo3*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,3,DoubleToStr(Fibo4*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,4,DoubleToStr(Fibo5*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,5,DoubleToStr(Fibo6*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,6,DoubleToStr(Fibo7*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,7,DoubleToStr(Fibo8*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,8,DoubleToStr(Fibo9*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,9,DoubleToStr(Fibo10*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,10,DoubleToStr(Fibo11*100,1));
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+11,-Fibo2);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+12,-Fibo3);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+13,-Fibo4);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+14,-Fibo5);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+15,-Fibo6);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+16,-Fibo7);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+17,-Fibo8);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+18,-Fibo9);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+19,-Fibo10);
        ObjectSet("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+20,-Fibo11);
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,11,"-"+DoubleToStr(Fibo2*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,12,"-"+DoubleToStr(Fibo3*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,13,"-"+DoubleToStr(Fibo4*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,14,"-"+DoubleToStr(Fibo5*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,15,"-"+DoubleToStr(Fibo6*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,16,"-"+DoubleToStr(Fibo7*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,17,"-"+DoubleToStr(Fibo8*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,18,"-"+DoubleToStr(Fibo9*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,19,"-"+DoubleToStr(Fibo10*100,1));
        ObjectSetFiboDescription("LeftChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,20,"-"+DoubleToStr(Fibo11*100,1));
       }
       if(ExtRightChannel)
       {
        ObjectCreate("RightLine"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_TREND,0,t2,p2,t1,p1+(p2-p1)*(2-ExtFiboRightChannel));
        ObjectSet("RightLine"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_BACK,ExtBack);
        ObjectSet("RightLine"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_COLOR,ExtChannelColor);
        ObjectSet("RightLine"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_STYLE,ExtChannelStyle);
        ObjectSet("RightLine"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_WIDTH,ExtChannelWidth);
        ObjectCreate("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJ_FIBOCHANNEL,0,t2,p2,t3,p1+(p2-p1)*ExtFiboRightChannel,t2,p1);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_COLOR,ExtChannelColor);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_STYLE,ExtChannelStyle);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_WIDTH,ExtChannelWidth);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIBOLEVELS,21);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELCOLOR,ExtChannelColor);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELSTYLE,ExtChannelStyle);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_LEVELWIDTH,ExtChannelWidth);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+0,Fibo1);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+1,Fibo2);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+2,Fibo3);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+3,Fibo4);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+4,Fibo5);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+5,Fibo6);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+6,Fibo7);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+7,Fibo8);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+8,Fibo9);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+9,Fibo10);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+10,Fibo11);
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,0,DoubleToStr(Fibo1*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,1,DoubleToStr(Fibo2*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,2,DoubleToStr(Fibo3*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,3,DoubleToStr(Fibo4*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,4,DoubleToStr(Fibo5*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,5,DoubleToStr(Fibo6*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,6,DoubleToStr(Fibo7*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,7,DoubleToStr(Fibo8*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,8,DoubleToStr(Fibo9*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,9,DoubleToStr(Fibo10*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,10,DoubleToStr(Fibo11*100,1));
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+11,-Fibo2);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+12,-Fibo3);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+13,-Fibo4);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+14,-Fibo5);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+15,-Fibo6);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+16,-Fibo7);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+17,-Fibo8);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+18,-Fibo9);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+19,-Fibo10);
        ObjectSet("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,OBJPROP_FIRSTLEVEL+20,-Fibo11);
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,11,"-"+DoubleToStr(Fibo2*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,12,"-"+DoubleToStr(Fibo3*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,13,"-"+DoubleToStr(Fibo4*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,14,"-"+DoubleToStr(Fibo5*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,15,"-"+DoubleToStr(Fibo6*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,16,"-"+DoubleToStr(Fibo7*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,17,"-"+DoubleToStr(Fibo8*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,18,"-"+DoubleToStr(Fibo9*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,19,"-"+DoubleToStr(Fibo10*100,1));
        ObjectSetFiboDescription("RightChannel"+"_"+ExtDepth+"_"+ExtComplect+"_"+save,20,"-"+DoubleToStr(Fibo11*100,1));
       }
}



Sample





Analysis



Market Information Used:

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


Indicator Curves created:


Implements a curve of type DRAW_SECTION

Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen