Time of a Bar

 
Is it possible to find the time of a Bar, I am stepping through a chart and want to do time related calculations ?
 

see Time[] or iTime()

 

Thanks Phy, I have tried these functions but they appear to work from the current server time. This is fine for getting the realtime value, but I am trying to run an expert/indicator on a chart to be able to identify past events.

As an example, I have tried to use both the Time() and iTime() functions to plot an arrow on a 5 minute chart at 9am through to 10am, but it only works going forwards and doesn't show arrows for 9am yesterday and prior.

Any ideas why or a small code snippet would be very appreciated.

 

Oh, sorry.

See iBarShift()

or

string name = "TimeArrow";
int count;
for(i = 0; i < 1000; i++){
   if(TimeHour(Time(i)) == 9 ){
      if(ObjectFind(name+count) != -1) ObjectDelete(name+count);
      ObjectCreate(name+count, OBJ_ARROW, 0, Time(i), High[i], 0,0);
      count++;
   }
}
 

Thanks Phy , all problems solved now and everyting works a treat !!!

Although, I did need [] round the time function, not ()

 

[] vs ()

oops..

Didn't compile it, just typed it here