Need solution how i can get data for just one Tick

 
Hello,

with next example you can get the High,Low and Closerate of the day.

  for(i=Bars-2; i>=0; i--)
     {
      if(High[i+1] > LastHigh) LastHigh = High[i+1];
      if(Low[i+1] < LastLow)   LastLow  = Low[i+1];
      //----
      if(TimeDay(Time[i]) != TimeDay(Time[i+1]))
        {
         P = (LastHigh + LastLow + Close[i+1])/3;
         LastLow  = Open[i];
         LastHigh = Open[i];
        }
      //----
      PBuffer[i]  = P;
     }

Now if the day change just for the first Tick you have in the variables LastHigh and LastLow the real rates, because if the next Tick comes in the variables LastHigh and LastLow will get just the low and high from the last bar in chart and not any more the rates from the last day, that ist because the variables LastLow and LastHigh get the rate from Open[i] along below.

Now i need a solution how i can let just for one tick all drain happens.

But at the next day if result of
TimeDay(Time[i]) != TimeDay(Time[i+1]) 

is again true all must happens from the beginning.
 
Hello again, I have found a solution, like this one:

        if(TimeDay(Time[i]) != TimeDay(Time[i+1]) && free!=2)
        {
         free=2;
         P = (LastHigh + LastLow + Close[i+1])/3;
         LastLow  = Open[i];
         LastHigh = Open[i];
        }
        if(TimeDay(Time[i]) == TimeDay(Time[i+1])){
        fee=1;
        }
Now it only works one Tick long and first if the days have change it will be make free for new run-up


Reason: