Can someone fix this error.

 
<Code posted in post #2>
Files:
 

Forum on trading, automated trading systems and testing trading strategies

When you post code please use the CODE button (Alt-S)!

Use the CODE button


Edit your post and paste the code correctly. You've been told this before.
 
#property indicator_chart_window

//---- indicator parameters
extern int TargetPeriod=24;
extern int FiboPeriod=24;
extern bool ShowTarget=true;
extern bool ShowFiboLines=false;
extern bool ShowHighLow=true;
extern int MaxBars=100;
extern color Line_color = Green;
extern color Target_color = Red;


//---- indicator buffers
double zzL[];
double zzH[];
double zz[];

double target1=0,target2=0;

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

   return(0);
  }
  int deinit()
  {
//----
   ObjectDelete("Target1=");
   ObjectDelete("Target2=");
   ObjectDelete("TargetUp");
   ObjectDelete("TargetDown");
   ObjectDelete("TP1");
   ObjectDelete("TP2");
   ObjectDelete("R0");
   ObjectDelete("R1");
   ObjectDelete("R2");
   ObjectDelete("R3");
   ObjectDelete("R4");
   ObjectDelete("R5");
   ObjectDelete("LH");
   ObjectDelete("LL");
   ObjectDelete("Low");
   ObjectDelete("High");
   ObjectDelete("1.0");
   ObjectDelete("0.618");
   ObjectDelete("0.5");
   ObjectDelete("0.382");
   ObjectDelete("0.236");
   ObjectDelete("0.0");
   Comment(" ");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double start()
  {
   int    i,shift,pos,lasthighpos,lastlowpos,curhighpos,curlowpos;
   int    targethighpos,targetlowpos;
   double curlow,curhigh,lasthigh,lastlow,targethigh,targetlow;
   double min, max;

   lasthighpos=Bars; lastlowpos=Bars;
   lastlow=Low[Bars];lasthigh=High[Bars];

   targethighpos=Bars; targetlowpos=Bars;
   targetlow=Low[Bars];targethigh=High[Bars];
   if(Bars<200)MaxBars=Bars;
 
  for(shift=MaxBars-FiboPeriod; shift>=0; shift--)
    {
      curlowpos=Lowest(NULL,0,MODE_LOW,FiboPeriod,shift);
      curlow=Low[curlowpos];
      curhighpos=Highest(NULL,0,MODE_HIGH,FiboPeriod,shift);
      curhigh=High[curhighpos];
  
     if(shift<MaxBars-TargetPeriod){ 
      targetlowpos=Lowest(NULL,0,MODE_LOW,TargetPeriod,shift);
      targetlow=Low[targetlowpos];
      targethighpos=Highest(NULL,0,MODE_HIGH,TargetPeriod,shift);
      targethigh=High[targethighpos];
      }
      //------------------------------------------------
      if( curlow>=lastlow ) { lastlow=curlow; }
      else
         { 
            if( lasthighpos>curlowpos  ) 
            { 
            zzL[curlowpos]=curlow;
              min=100000; pos=lasthighpos;
               for(i=lasthighpos; i>=curlowpos; i--)
                  { 
                    if (zzL[i]==0.0) continue;
                    if (zzL[i]<min) { min=zzL[i]; pos=i; }
                    zz[i]=0.0;
                  } 
               zz[pos]=min;
            } 
          lastlowpos=curlowpos;
          lastlow=curlow; 
         }
      //--- high
      if( curhigh<=lasthigh )  { lasthigh=curhigh;}
      else
         {  
            if( lastlowpos>curhighpos ) 
            {  
            zzH[curhighpos]=curhigh;
               max=-100000; pos=lastlowpos;
               for(i=lastlowpos; i>=curhighpos; i--)
                  { 
                    if (zzH[i]==0.0) continue;
                    if (zzH[i]>max) { max=zzH[i]; pos=i; }
                    zz[i]=0.0;
                  } 
               zz[pos]=max;
            }  
         lasthighpos=curhighpos;
         lasthigh=curhigh;    
         }       
double p, r5,r4,r3,r2,r1,r0;    
double R2= targethigh - targetlow;
double R1= lasthigh - lastlow;
double R= High[lasthighpos] - Low[lastlowpos];
int div=10000;

if(Digits==2)div=100;
if(Digits==4)div=10000;
if(Digits==5)div=100000;


if(lastlowpos<lasthighpos) {
p = curlow;
r5 = p + (R * 1);
r4 = p + (R * 0.618);
r3 = p + (R * 0.5);
r2 = p + (R * 0.382);
r1 = p + (R * 0.236);
r0 = p + (R * 0);
if(Close[0]>(targetlow+(R2*0.618)) )target1= targethigh + (R2 * 0.618);
if(Close[0]>target1)target1= 0; 


}

if(lasthighpos<lastlowpos) {
 p = curhigh;
r5 = p - (R * 1); 
r4 = p - (R * 0.618);
r3 = p - (R * 0.5);
r2 = p - (R * 0.382);
r1 = p - (R * 0.236);
r0 = p - (R * 0);
if(Close[0]<(targethigh-(R2*0.618)) )target2= targetlow - (R2 * 0.618);
if(Close[0]<target2 )target2= 0; 

}

if(ShowHighLow==true){
drawLine(High[lasthighpos],"LH", Line_color,1);
drawLabel("High",High[lasthighpos],Line_color,13);
drawLine(Low[lastlowpos],"LL", Line_color,1);
drawLabel("Low",Low[lastlowpos],Line_color,13);
}
if(ShowHighLow==false && ShowFiboLines==true){
drawLine(r5,"R5", Yellow,2);
drawLabel("1.0",r5,Yellow,13);   
drawLine(r0,"R0", Yellow,2);
drawLabel("0.0",r0,Yellow,13);
}
if(ShowFiboLines==true){
drawLine(r4,"R4", Yellow,2);
drawLabel("0.618",r4,Yellow,13);
drawLine(r3,"R3", Yellow,2);
drawLabel("0.5",r3,Yellow,13);
drawLine(r2,"R2", Yellow,2);
drawLabel("0.382",r2,Yellow,13);
drawLine(r1,"R1", Yellow,2);
drawLabel("0.236",r1,Yellow,13);
}
 
if(target1>0 && ShowTarget==true){
drawLine(target1,"TP1", Target_color,2);
drawLabel("TargetUp",target1,Target_color,7);
drawTarget("Target1=",target1,Target_color,1);
}

if(target2>0 && ShowTarget==true){
drawLine(target2,"TP2", Target_color,2);
drawLabel("TargetDown",target2,Target_color,7);
drawTarget("Target2=",target2,Target_color,2);
}


}

  }
  
  void drawTarget(string name,double lvl,color Color,int num)
{
 
    string target=DoubleToStr(lvl, Digits);

     ObjectCreate(name, OBJ_LABEL, 0, 0, 0);
if(num==1){
        ObjectSet(name, OBJPROP_XDISTANCE, 340);
        ObjectSet(name, OBJPROP_YDISTANCE, 2);

    ObjectSetText(name, "Target UP = "+target, 9, "Arial", Lime);
}
if(num==2){
        ObjectSet(name, OBJPROP_XDISTANCE, 470);
        ObjectSet(name, OBJPROP_YDISTANCE, 2);

    ObjectSetText(name, "Target DOWN = "+target, 9, "Arial", Lime);
}
       
}

//+------------------------------------------------------------------+
void drawLabel(string name,double lvl,color Color,int time)
{

    if(ObjectFind(name) != 0)
    {
        ObjectCreate(name, OBJ_TEXT, 0, Time[time], lvl);
        ObjectSetText(name, name, 8, "Arial", EMPTY);
        ObjectSet(name, OBJPROP_COLOR, Color);
    }
    else
    {
        ObjectMove(name, 0, Time[time], lvl);
    }
}

void drawLine(double lvl,string name, color Col,int type)
{
         if(ObjectFind(name) != 0)
         {  
               
            if(type == 1){
            ObjectCreate(name, OBJ_HLINE, 0, Time[0], lvl,Time[0],lvl); 
            ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID);    
    
            }
            else {
            ObjectCreate(name, OBJ_GANNLINE, 0, Time[15], lvl,Time[0],lvl);
            ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID);    
                 }
                 
            ObjectSet(name, OBJPROP_COLOR, Col);
            ObjectSet(name,OBJPROP_WIDTH,1);
            
         }
         else
         {
            ObjectDelete(name);
            
            if(type == 1){
            ObjectCreate(name, OBJ_HLINE, 0, Time[0], lvl,Time[0],lvl);
            ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID);
            }
            
            else {
            ObjectCreate(name, OBJ_GANNLINE, 0, Time[15], lvl,Time[0],lvl);
            ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID);
            }
                 
            ObjectSet(name, OBJPROP_COLOR, Col);        
            ObjectSet(name,OBJPROP_WIDTH,1);
          
         }

    //----------------------------------------------------------------------
    }
//+------------------------------------------------------------------+

Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Indicators Lines
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Indicators Lines
  • www.mql5.com
Some technical indicators have several buffers drawn in the chart. Numbering of indicator buffers starts with 0. When copying indicator values using the CopyBuffer() function into an array of the double type, for some indicators one may indicate the identifier of a copied buffer instead of its number.
 
double start()
"Start function declared with incorrect type" is obvious. Perhaps you should read the manual.