limit to fibbo retracement placing?

 

hi every one 

i'm trying to make  a fibbo retracement with 10 level  but it do not create level 10 at all 

this is my code:

double PercLevels[10]= {0.382,0.500,0.618,0.786,0.88,1.27,1.5,1.61,2.00,2.61};
void OnStart()
{
//---

 

            Fibonacci_Retracement(0,Obj_Name,0,iTime(NULL,0,10),iClose(NULL,0,10),iTime(NULL,0,2),iClose(NULL,0,2),clrDarkGreen,STYLE_SOLID,2);
    


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

//+------------------------------------------------------------------+
bool Fibonacci_Retracement(const long       chart_ID=0,
                           const string          name="FiboLevels",
                           const int             sub_window=0,
                           datetime              time1=0,
                           double                price1=0,
                           datetime              time2=0,
                           double                price2=0,
                           const color           clr=clrOrange,
                           const ENUM_LINE_STYLE style=STYLE_SOLID,
                           const int             width=2,
                           const bool            back=false,
                           const bool            selection=true,
                           const bool            ray_right=true,
                           const bool            hidden=true,
                           const long            z_order=0)
{

   ResetLastError();
   if(ObjectCreate(chart_ID,name,OBJ_FIBO,sub_window,time1,price1,time2,price2))
   {
      ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
      ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
      ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
      ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
      ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
      ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
      ObjectSetInteger(chart_ID,name,OBJPROP_RAY_RIGHT,ray_right);
      ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
      ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
      //**************************************************************
      for(int i=0; i<=9; i++)
      {

         ObjectSetDouble(chart_ID,name,OBJPROP_LEVELVALUE,i,PercLevels[i]);

         ObjectSetInteger(chart_ID,name,OBJPROP_LEVELCOLOR,i,clrOrange);

         ObjectSetInteger(chart_ID,name,OBJPROP_LEVELSTYLE,i,STYLE_SOLID);

         ObjectSetInteger(chart_ID,name,OBJPROP_LEVELWIDTH,i,2);

         ObjectSetString(chart_ID,name,OBJPROP_LEVELTEXT,i,DoubleToString(100*PercLevels[i],1));

      }
      Print("GetLAstError:",GetLastError());


      ChartRedraw();
      return(true);
   }
   else
   {
      Print(__FUNCTION__,
            ": failed to create => ",name," object! Error code = ",GetLastError());
      return(false);
   }
}
 
Don't use Fibonacci (Use Horizontal Line Object).
 
42123481:
Don't use Fibonacci (Use Horizontal Line Object).

the problem is with changing the main line of the fibbo that line line wouldn't change(i know i can change it with a chart event but it's need to run a indicator in the chart, i just one to change the fibbo with one time script run)

 

i found what i was missing i forgot to determine how many fibbo level i want 

I'm writing for someone else have same problem in the future 

ObjectSetInteger(chart_ID,name,OBJPROP_LEVELS,levels);