Custom edit and Adjust level indicator tool - page 2

 
deVries:


OK explanation how to do

if (ObjectType(TrendName)== OBJ_TREND)

you look if P1 P2 T1 T2 are same values as you find with objectget

if one of them is different you have to delete the horizontal lines of the indicator

and calculate the new distance between the lines

with 8 lines then there are 7 areas between high and low

now you have to create the new lines with the new distance

also in deinit you have to delete the objects of the indicator

try to do this yourself and we help you further

or place a job at Jobs and i can give it you there (with explanation) if you pay me for this $10


Here a testingversion so you can see how it has to be (according to me)

free to choose what name for trendline and free to choose how many lines between high and low trendline

Files:
 
deVries:


OK explanation how to do

if (ObjectType(TrendName)== OBJ_TREND)

you look if P1 P2 T1 T2 are same values as you find with objectget

if one of them is different you have to delete the horizontal lines of the indicator

and calculate the new distance between the lines

with 8 lines then there are 7 areas between high and low

now you have to create the new lines with the new distance

also in deinit you have to delete the objects of the indicator

try to do this yourself and we help you further

or place a job at Jobs and i can give it you there if you pay me for this $10




I've mange to do it, Still have a problem in the refresh rate (the chart won't update automatically but only after I ctrl+i and than OK). I'll work on the refresh - Thank :-)
 
jorsde:

I've mange to do it, Still have a problem in the refresh rate (the chart won't update automatically but only after I ctrl+i and than OK). I'll work on the refresh - Thank :-)

Did you try WindowRedraw();

 
SDC:

Did you try WindowRedraw();


no not needed this moment market is not open so if my program is not showing hlines then wait till markets open
 
deVries:

no not needed this moment market is not open so if my program is not showing hlines then wait till markets open

I've made some changes in the code and now it can also draw Gann's angles and vertical lines.

I've tried it now but it doesn't work (I'm probably using it wrong or in the wrong place).It only updates after Ctrl+I .

What am I doing wrong ?

Thanks

Files:
 

your code...

#property copyright "Copyright 2013 - Jorsde"
#property link      ""
#property indicator_chart_window


extern int Cycle=100;
extern int Num_Of_Levels=8;
extern string TrendName = "Gann";
extern color Level_Color = DodgerBlue;
extern color Vertical_Color=Yellow; 
extern double P1New,P2New;
extern datetime T1New,T2New;
extern bool DrawAngles=false;
extern bool DrawLines=true;
extern bool DrawTimeExtention=true;        //not needed as input 

double P1=0, P2=0;
datetime T1,T2;                //check with objectget  if P1 is price1 and P2 is .....   and ...





//The next function will draw the trend line automatically by identifing the swing high and low
void IdentifyLevels()
{
   double P1=0;
   double P2=0;
   datetime T1;
   datetime T2;
   int HighBarsBack;
   int LowBarsBack;
      
   P1=High[iHighest(NULL,0,MODE_HIGH,Cycle,1)]; //Calculate the highest relevant point
   P2= Low[iLowest(NULL,0,MODE_LOW,Cycle,1)]; //Calculate the lowest relevant point
   T1=Time[iHighest(NULL,0,MODE_HIGH,Cycle,1)]; //get the time 
   T2=Time[iLowest(NULL,0,MODE_LOW,Cycle,1)];  //get the time 
   HighBarsBack = iBarShift(NULL, 0, T1);
   LowBarsBack = iBarShift(NULL, 0, T2);
   
   //Draw a trendline with the specific coordinates
   ObjectCreate(TrendName,OBJ_TREND,0,T1,P1,T2,P2);
   ObjectSet(TrendName,OBJPROP_COLOR,Red); 
   ObjectSet(TrendName,OBJPROP_WIDTH,1);
   ObjectSet(TrendName,OBJPROP_RAY,false);
   ObjectSet(TrendName, OBJPROP_STYLE, STYLE_DASH);
   
}                                   //with the change you want the object trend doesn't have to be created by indicator 
                                    
//The next function will draw the Gann vertical line for the time square forecast                     
void GannTimeExtention(datetime T1,datetime T2)
{
   int DateRange,DateDelta; 
   
   if(T1>T2) // make sure that the DateRange and DateDelta are positive
   {
      DateRange=T1-T2; 
      DateDelta=DateRange+T1;
   }
   else
   {
      DateRange=T2-T1;
      DateDelta=DateRange+T2;
   }
   
   Print("GannTimeExtention() Value of T1 ",T1);
   Print("GannTimeExtention() Value of T2 ",T2);
   Print("GannTimeExtention() Value of DateRange ",DateRange);
   Print("GannTimeExtention() Value of DateDelta ",DateDelta);
   
   datetime time = StrToTime(TimeToStr(DateDelta, TIME_DATE) + " " + " " + " ");
   ObjectCreate("Gann Time Extention", OBJ_VLINE, 0, time, 0);
   ObjectSet("Gann Time Extention",OBJPROP_COLOR,Vertical_Color); 
   ObjectSet("Gann Time Extention",OBJPROP_WIDTH,2);
   ObjectSet("Gann Time Extention", OBJPROP_BACK, true);
}                                                                              //vertical line not needed
 
// The next function will check if the current coordinates have changed. If so it will update them 
void CheckCoordinates(double P1,double P2,datetime T1,datetime T2)
{
   int HighBarsBack=0;
   int LowBarsBack=0;       //what function has this ??
   
   WindowRedraw(); 
   
   if(P1New!=P1 || P2New!=P2 || T1New!=T1 || T2New!=T2)
   {
      DropAllLines();

   if( P1 != ObjectGet(TrendName, OBJPROP_PRICE1)||
      T1 != ObjectGet(TrendName, OBJPROP_TIME1)||
      P2 != ObjectGet(TrendName, OBJPROP_PRICE2)||
      T2 != ObjectGet(TrendName, OBJPROP_TIME2))
      HighBarsBack = iBarShift(NULL, 0, T1);
      LowBarsBack = iBarShift(NULL, 0, T2);
      
      P1 = ObjectGet(TrendName, OBJPROP_PRICE1);                                                              ;
      P2New=P2;
      T1New=T1;
      T2New=T2;   change also
      
      WindowRedraw(); DropAllLines()
      DrawGannLines(P1,P2,T1,T2, HighBarsBack,LowBarsBack);   
   }
}

//The next function will draw Gann levels determine by the number of levels.
void DrawGannLines(double P1,double P2,datetime T1,datetime T2,int HighBarsBack,int LowBarsBack)
{
   double Range,Cal_Val,Temp;

   if(P1>P2) 
   {
      Range = P1-P2; // Calculate the range between high and low 
      Temp=P2; //Give Temp the lowest value so it will start drawing the lines from bottom up
   }
   else  
   {
      Range = P2-P1; // Calculate the range between high and low 
      Temp=P1; //Give Temp the lowest value so it will start drawing the lines from bottom up
   }
   
   Cal_Val=Range/Num_Of_Levels; // calculate the delta between the levels
   Num_Of_Levels = Num_Of_Levels+1; 
   
   if(HighBarsBack>LowBarsBack){int length = HighBarsBack;} else{length = LowBarsBack;}
   
   WindowRedraw();
   
   for(int i=0; i<Num_Of_Levels; i++)
   {
      switch (i)
      {
         case 0: ObjectCreate("0", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("0",OBJPROP_COLOR,Level_Color); ObjectSet("0",OBJPROP_WIDTH,2);   break;
         case 1: ObjectCreate("1", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("1",OBJPROP_COLOR,Level_Color); ObjectSet("1",OBJPROP_WIDTH,2);  break;
         case 2: ObjectCreate("2", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("2",OBJPROP_COLOR,Level_Color); ObjectSet("2",OBJPROP_WIDTH,2);  break;
         case 3: ObjectCreate("3", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("3",OBJPROP_COLOR,Level_Color); ObjectSet("3",OBJPROP_WIDTH,2);  break;
         case 4: ObjectCreate("4", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("4",OBJPROP_COLOR,Level_Color); ObjectSet("4",OBJPROP_WIDTH,2);  break;
         case 5: ObjectCreate("5", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("5",OBJPROP_COLOR,Level_Color); ObjectSet("5",OBJPROP_WIDTH,2);  break;
         case 6: ObjectCreate("6", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("6",OBJPROP_COLOR,Level_Color); ObjectSet("6",OBJPROP_WIDTH,2);  break;
         case 7: ObjectCreate("7", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("7",OBJPROP_COLOR,Level_Color); ObjectSet("7",OBJPROP_WIDTH,2);  break;
         case 8: ObjectCreate("8", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("8",OBJPROP_COLOR,Level_Color); ObjectSet("8",OBJPROP_WIDTH,2);  break;
         case 9: ObjectCreate("9", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("9",OBJPROP_COLOR,Level_Color); ObjectSet("9",OBJPROP_WIDTH,2);  break;
         case 10: ObjectCreate("10", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("10",OBJPROP_COLOR,Level_Color); ObjectSet("10",OBJPROP_WIDTH,2); break;
         default:  break;
      }
      Temp = Temp+Cal_Val;   
   }
}

//The next function will draw the Gann angles
void DrawAngles(double P1,double P2,datetime T1,datetime T2)  
{
   double LowValue,HighValue;
   int HstBar,RecBar;
   
   if(P1>P2) 
   {
      HighValue=P1;
      LowValue=P2;  
   }
   else  
   {
      HighValue=P2;
      LowValue=P1;
   }

   if(T1>T2) 
   {
      RecBar=T1;
      HstBar=T2;
   }
   else
   {
      RecBar=T2;
      HstBar=T1;
   }
   
   if(P1>P2 && T1>T2)
   {
      RecBar=T2;
      HstBar=T1;   
   }
   
      DrawAngleLine("45 Angle 1x1",RecBar,LowValue,45); //1x1
      DrawAngleLine("64 Angle 2x1",RecBar,LowValue,64); //2x1 - should be 63.75 but only full numbers are allowed
      DrawAngleLine("71.25 Angle 3x1",RecBar,LowValue,71.25); //3x1
      DrawAngleLine("75 Angle 4x1",RecBar,LowValue,75); //4x1
      DrawAngleLine("82.5 Angle 8x1",RecBar,LowValue,82.5); //8x1
      DrawAngleLine("86.25 Angle 16x1",RecBar,LowValue,86.25); //16x1
      DrawAngleLine("26.25 Angle 2x1",RecBar,LowValue,26.25); //2x1 - Negative side
      DrawAngleLine("15 Angle 4x1",RecBar,LowValue,15); //4x1
      DrawAngleLine("7.5 Angle 8x1",RecBar,LowValue,7.5); //8x1
       
      DrawAngleLine("-45 Angle 1x1",HstBar,HighValue,-45); //1x1
      DrawAngleLine("-64 Angle 2x1",HstBar,HighValue,-64); //2x1 - should be 63.75 but only full numbers are allowed
      DrawAngleLine("-71.25 Angle 3x1",HstBar,HighValue,-71.25); //3x1
      DrawAngleLine("-75 Angle 4x1",HstBar,HighValue,-75); //4x1
      DrawAngleLine("-82.5 Angle 8x1",HstBar,HighValue,-82.5); //8x1
      DrawAngleLine("-86.25 Angle 16x1",HstBar,HighValue,-86.25); //16x1
      DrawAngleLine("-26.25 Angle 2x1",HstBar,HighValue,-26.25); //2x1 - Negative side
      DrawAngleLine("-15 Angle 4x1",HstBar,HighValue,-15); //4x1
      DrawAngleLine("-7.5 Angle 8x1",HstBar,HighValue,-7.5); //8x1
}

//The next funaction will do the actual drawing of the angles
void DrawAngleLine(string lname,int bar,double value,int angle)
{ 
   int   style;
   color linecolor;

   if (angle>0)
   {
      linecolor=Aqua;
      if (angle==45 || angle==64 || angle==75) style=STYLE_SOLID; else style=STYLE_DASHDOT; 
   }
   else 
   {
      linecolor=Magenta;
      if (angle==-45 || angle==-64 || angle==-75) style=STYLE_SOLID;else style=STYLE_DASHDOT;
   } 
   ObjectCreate(lname,OBJ_TRENDBYANGLE,0,bar,value); 
   ObjectSet(lname,OBJPROP_COLOR,linecolor);
   ObjectSet(lname,OBJPROP_STYLE,style);
   ObjectSet(lname,OBJPROP_WIDTH,1);
   ObjectSet(lname,OBJPROP_ANGLE,angle);     
}

//The next funaction will remove all lines except for the trend line.
void DropAllLines()
{
   int obj_total=ObjectsTotal();
   string obj_name;
   ObjectDelete("45 Angle 1x1");
   ObjectDelete("64 Angle 2x1");
   ObjectDelete("71.25 Angle 3x1");
   ObjectDelete("75 Angle 4x1");
   ObjectDelete("82.5 Angle 8x1");
   ObjectDelete("86.25 Angle 16x1");
   ObjectDelete("26.25 Angle 2x1");
   ObjectDelete("15 Angle 4x1");
   ObjectDelete("7.5 Angle 8x1");
   ObjectDelete("-45 Angle 1x1");
   ObjectDelete("-64 Angle 2x1");
   ObjectDelete("-71.25 Angle 3x1");
   ObjectDelete("-75 Angle 4x1");
   ObjectDelete("-82.5 Angle 8x1");
   ObjectDelete("-86.25 Angle 16x1");
   ObjectDelete("-26.25 Angle 2x1");
   ObjectDelete("-15 Angle 4x1");
   ObjectDelete("-7.5 Angle 8x1");
   ObjectDelete("Gann Time Extention");
   ObjectDelete("0");
   ObjectDelete("1");
   ObjectDelete("2");
   ObjectDelete("3");
   ObjectDelete("4");
   ObjectDelete("5");
   ObjectDelete("6");
   ObjectDelete("7");
   ObjectDelete("8");
   ObjectDelete("9");
   ObjectDelete("10");
}

int init()
  {
   IdentifyLevels();
   return(0);
  }

int deinit()
  {
   DropAllLines();
   return(0);
  }


int start()
{ 
   double P1=0, P2=0;
   double LowValue=0;
   datetime T1,T2;
   int HighBarsBack = 0;
   int LowBarsBack = 0;

   if (ObjectType(TrendName)== OBJ_TREND)
   {
     P1 = ObjectGet(TrendName, OBJPROP_PRICE1);
     T1 = ObjectGet(TrendName, OBJPROP_TIME1);
     P2 = ObjectGet(TrendName, OBJPROP_PRICE2);
     T2 = ObjectGet(TrendName, OBJPROP_TIME2);

     HighBarsBack = iBarShift(NULL, 0, T1);
     LowBarsBack = iBarShift(NULL, 0, T2);

     //Update the first time
     P1New=P1;
     P2New=P2;
     T1New=T1;
     T2New=T2;     
   }
   else
   {
     DropAllLines();
     return(0);
   }
   
   CheckCoordinates(P1,P2,T1,T2);         
   if(DrawAngles==true) DrawAngles(P1,P2,T1,T2) ;
   if(DrawLines==true) DrawGannLines(P1,P2,T1,T2,HighBarsBack,LowBarsBack);
   if(DrawTimeExtention==true) GannTimeExtention(T1,T2);
      
   return(0);
}

what you wantes was you create a line on the chart between two points

this line we can make with objecttype trend and then we give it a name we also have as inputparameter of our indicator

begin of the line we find at price1 time1 and end of the line is price2 time2

change drawgannlines ==> DrawGannLines(P1,P2,T1,T2) then you can see your calculation horizontallines is still wrong 8 lines 7 levels above first line

 

Hi

You're right the HighBarsBack, LowBarsBack are not needed.

I did want the indicator to search automatically the swing high/low when I load it (and then fix it if I don't think it is the correct swings levels).

Anyway I've manage to do it - Thank You very much for your help.

The changes are in

void CheckCoordinates(double P1,double P2,datetime T1,datetime T2)
{
   if(P1New!=P1 || P2New!=P2 || T1New!=T1 || T2New!=T2)
   {

      P1 = ObjectGet(TrendName, OBJPROP_PRICE1);
      T1 = ObjectGet(TrendName, OBJPROP_TIME1);
      P2 = ObjectGet(TrendName, OBJPROP_PRICE2);
      T2 = ObjectGet(TrendName, OBJPROP_TIME2);

      P1New=P1;
      P2New=P2;
      T1New=T1;
      T2New=T2;

      DrawGannLines(P1,P2,T1,T2);
   }
}


//The next function will draw Gann levels determine by the number of levels.
void DrawGannLines(double P1,double P2,datetime T1,datetime T2)
{
   double Range,Cal_Val,Temp;
   int RealNumberOfLevels=Num_Of_Levels+1; 

   if(P1>P2) 
   {
      Range = P1-P2; // Calculate the range between high and low 
      Temp=P2; //Give Temp the lowest value so it will start drawing the lines from bottom up
   }
   else  
   {
      Range = P2-P1; // Calculate the range between high and low 
      Temp=P1; //Give Temp the lowest value so it will start drawing the lines from bottom up
   }
   
   Cal_Val=Range/Num_Of_Levels; // calculate the delta between the levels
   
   DropAllLines();
   for(int i=0; i<RealNumberOfLevels; i++)
   {
      switch (i)
      {
         case 0: ObjectCreate("0", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("0",OBJPROP_COLOR,Level_Color); ObjectSet("0",OBJPROP_WIDTH,2);   break;
         case 1: ObjectCreate("1", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("1",OBJPROP_COLOR,Level_Color); ObjectSet("1",OBJPROP_WIDTH,2);  break;
         case 2: ObjectCreate("2", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("2",OBJPROP_COLOR,Level_Color); ObjectSet("2",OBJPROP_WIDTH,2);  break;
         case 3: ObjectCreate("3", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("3",OBJPROP_COLOR,Level_Color); ObjectSet("3",OBJPROP_WIDTH,2);  break;
         case 4: ObjectCreate("4", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("4",OBJPROP_COLOR,Level_Color); ObjectSet("4",OBJPROP_WIDTH,2);  break;
         case 5: ObjectCreate("5", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("5",OBJPROP_COLOR,Level_Color); ObjectSet("5",OBJPROP_WIDTH,2);  break;
         case 6: ObjectCreate("6", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("6",OBJPROP_COLOR,Level_Color); ObjectSet("6",OBJPROP_WIDTH,2);  break;
         case 7: ObjectCreate("7", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("7",OBJPROP_COLOR,Level_Color); ObjectSet("7",OBJPROP_WIDTH,2);  break;
         case 8: ObjectCreate("8", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("8",OBJPROP_COLOR,Level_Color); ObjectSet("8",OBJPROP_WIDTH,2);  break;
         case 9: ObjectCreate("9", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("9",OBJPROP_COLOR,Level_Color); ObjectSet("9",OBJPROP_WIDTH,2);  break;
         case 10: ObjectCreate("10", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("10",OBJPROP_COLOR,Level_Color); ObjectSet("10",OBJPROP_WIDTH,2); break;
         default:  break;
      }
      Temp = Temp+Cal_Val;   
   }
   WindowRedraw();
}
 

this can't work this way ....

void CheckCoordinates(double P1,double P2,datetime T1,datetime T2)
{
   if(P1New!=P1 || P2New!=P2 || T1New!=T1 || T2New!=T2)
   {
  if( P1 != ObjectGet(TrendName, OBJPROP_PRICE1)||
      T1 != ObjectGet(TrendName, OBJPROP_TIME1)||
      P2 != ObjectGet(TrendName, OBJPROP_PRICE2)||
      T2 != ObjectGet(TrendName, OBJPROP_TIME2))
{       P1 = ObjectGet(TrendName, OBJPROP_PRICE1);       T1 = ObjectGet(TrendName, OBJPROP_TIME1);       P2 = ObjectGet(TrendName, OBJPROP_PRICE2);       T2 = ObjectGet(TrendName, OBJPROP_TIME2);       P1New=P1;       P2New=P2;       T1New=T1;       T2New=T2;
DropAllLines()
      DrawGannLines(P1,P2,T1,T2);    } }

do you see why ?? there is also here no input needed to find p1,.....

i gave solution in latest post..

 
Well actually it did work but I've decided to remove the 4 lines (see below) - anyway it is working now - Thank you.
int start()
{ 
   double P1=0, P2=0;
   double LowValue=0;
   datetime T1,T2;

   if (ObjectType(TrendName)== OBJ_TREND)
   {
     P1 = ObjectGet(TrendName, OBJPROP_PRICE1);
     T1 = ObjectGet(TrendName, OBJPROP_TIME1);
     P2 = ObjectGet(TrendName, OBJPROP_PRICE2);
     T2 = ObjectGet(TrendName, OBJPROP_TIME2);


     //Update the first time
     P1Coordinates=P1;
     P2Coordinates=P2;
     T1Coordinates=T1;
     T2Coordinates=T2;  
   }
   else
   {
     DropAllLines();
     return(0);
   }
   
   CheckCoordinates(P1,P2,T1,T2);
   if(DrawLines==true) DrawGannLines(P1,P2,T1,T2);         
   if(DrawAngles==true) DrawAngles(P1,P2,T1,T2);
   if(DrawTimeExtention==true) GannTimeExtention(T1,T2);
      
   return(0);
}



// The next function will check if the current coordinates have changed. If so it will update the lines 
void CheckCoordinates(double P1,double P2,datetime T1,datetime T2)
{
   if(P1Coordinates!=P1 || P2Coordinates!=P2 || T1Coordinates!=T1 || T2Coordinates!=T2)
   {
      P1 = ObjectGet(TrendName, OBJPROP_PRICE1);
      T1 = ObjectGet(TrendName, OBJPROP_TIME1);
      P2 = ObjectGet(TrendName, OBJPROP_PRICE2);
      T2 = ObjectGet(TrendName, OBJPROP_TIME2);

      if(DrawAngles==true) DrawAngles(P1,P2,T1,T2);
      if(DrawLines==true) DrawGannLines(P1,P2,T1,T2);
      if(DrawTimeExtention==true) GannTimeExtention(T1,T2);
   }
}

//The next function will draw Gann levels determine by the number of levels.
void DrawGannLines(double P1,double P2,datetime T1,datetime T2)
{
   double Range,Cal_Val,Temp;
   int RealNumberOfLevels=Num_Of_Levels+1; 

   if(P1>P2) 
   {
      Range = P1-P2; // Calculate the range between high and low 
      Temp=P2; //Give Temp the lowest value so it will start drawing the lines from bottom up
   }
   else  
   {
      Range = P2-P1; // Calculate the range between high and low 
      Temp=P1; //Give Temp the lowest value so it will start drawing the lines from bottom up
   }
   
   Cal_Val=Range/Num_Of_Levels; // calculate the delta between the levels
   
   DropAllLines();
   for(int i=0; i<RealNumberOfLevels; i++)
   {
      switch (i)
      {
         case 0: ObjectCreate("0", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("0",OBJPROP_COLOR,Level_Color); ObjectSet("0",OBJPROP_WIDTH,2);   break;
         case 1: ObjectCreate("1", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("1",OBJPROP_COLOR,Level_Color); ObjectSet("1",OBJPROP_WIDTH,2);  break;
         case 2: ObjectCreate("2", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("2",OBJPROP_COLOR,Level_Color); ObjectSet("2",OBJPROP_WIDTH,2);  break;
         case 3: ObjectCreate("3", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("3",OBJPROP_COLOR,Level_Color); ObjectSet("3",OBJPROP_WIDTH,2);  break;
         case 4: ObjectCreate("4", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("4",OBJPROP_COLOR,Level_Color); ObjectSet("4",OBJPROP_WIDTH,2);  break;
         case 5: ObjectCreate("5", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("5",OBJPROP_COLOR,Level_Color); ObjectSet("5",OBJPROP_WIDTH,2);  break;
         case 6: ObjectCreate("6", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("6",OBJPROP_COLOR,Level_Color); ObjectSet("6",OBJPROP_WIDTH,2);  break;
         case 7: ObjectCreate("7", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("7",OBJPROP_COLOR,Level_Color); ObjectSet("7",OBJPROP_WIDTH,2);  break;
         case 8: ObjectCreate("8", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("8",OBJPROP_COLOR,Level_Color); ObjectSet("8",OBJPROP_WIDTH,2);  break;
         case 9: ObjectCreate("9", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("9",OBJPROP_COLOR,Level_Color); ObjectSet("9",OBJPROP_WIDTH,2);  break;
         case 10: ObjectCreate("10", OBJ_HLINE, 0,Time[0], Temp); ObjectSet("10",OBJPROP_COLOR,Level_Color); ObjectSet("10",OBJPROP_WIDTH,2); break;
         default:  break;
      }
      Temp = Temp+Cal_Val;   
   }
   WindowRedraw();
}
 
jorsde:
Well actually it did work but I've decided to remove the 4 lines (see below) - anyway it is working now - Thank you.
everything i colored red could be removed....
Reason: