//| Script program start function                                    |  //+——————————————————————+  void OnStart()    {  //— auxiliary arrays     double high[],low[],price1,price2;     datetime time[],time1,time2;  //— Copy the open prices – 100 latest bars are enough     int copied=CopyHigh(Symbol(),0,0,100,high);     if(copied<=0)       {        Print(“Failed to copy the values of the High price series”);        return;       }  //— Copy the close price – 100 latest bars are enough     copied=CopyLow(Symbol(),0,0,100,low);     if(copied<=0)       {        Print(“Failed to copy the values of the Low price series”);        return;       }  //— Copy the open time for the last 100 bars     copied=CopyTime(Symbol(),0,0,100,time);     if(copied<=0)       {        Print(“Failed to copy the values of the price series of Time”);        return;       }  //— Organize access to the copied data as to timeseries – backwards     ArraySetAsSeries(high,true);     ArraySetAsSeries(low,true);     ArraySetAsSeries(time,true);     //— Coordinates of the first anchor point of the Fibo object     price1=high[70];     time1=time[70];  //— Coordinates of the second anchor point of the Fibo object     price2=low[50];     time2=time[50];     //— Time to create the Fibo object     bool created=ObjectCreate(0,“Fibo”,OBJ_FIBO,0,time1,price1,time2,price2);     if(created) // If the object is created successfully       {        //— set the color of Fibo levels        ObjectSetInteger(0,“Fibo”,OBJPROP_LEVELCOLOR,Blue);        //— by the way, how much Fibo levels do we have?        int levels=ObjectGetInteger(0,“Fibo”,OBJPROP_LEVELS);        Print(“Fibo levels before = “,levels);        //—output to the Journal => number of level:value level_desription        for(int i=0;i<levels;i++)          {           Print(i,“: “,ObjectGetDouble(0,“Fibo”,OBJPROP_LEVELVALUE,i),                 ”  “,ObjectGetString(0,“Fibo”,OBJPROP_LEVELTEXT,i));          }        //— Try to increase the number of levels per unit        bool modified=ObjectSetInteger(0,“Fibo”,OBJPROP_LEVELS,levels+1);        if(!modified) // failed to change the number of levels          {           Print(“Failed to change the number of levels of Fibo, error “,GetLastError());          }        //— just inform        Print(“Fibo levels after = “,ObjectGetInteger(0,“Fibo”,OBJPROP_LEVELS));        //— set a value for a newly created level        bool added=ObjectSetDouble(0,“Fibo”,OBJPROP_LEVELVALUE,levels,133);        if(added) // managed to set a value for the level          {           Print(“Successfully set one more Fibo level”);           //— Also do not forget to set the level description           ObjectSetString(0,“Fibo”,OBJPROP_LEVELTEXT,levels,“my level”);           ChartRedraw(0);           //— Get the actual value of the number of levels in the Fibo object           levels=ObjectGetInteger(0,“Fibo”,OBJPROP_LEVELS);           Print(“Fibo levels after adding = “,levels);           //— once again output all levels – just to make sure           for(int i=0;i<levels;i++)             {              Print(i,“:”,ObjectGetDouble(0,“Fibo”,OBJPROP_LEVELVALUE,i),                    ”  “,ObjectGetString(0,“Fibo”,OBJPROP_LEVELTEXT,i));             }          }        else // Fails if you try to increase the number of levels in the Fibo object          {           Print(“Failed to set one more Fibo level. Error “,GetLastError());          }       }    }  |