Finding bid/ask price at a particular servertime from history.

 
Is it possible to find the price of ask and bid say at server time: 2012.02.09 11:17:16 from history? If yes, I would appreciate your help.
 
The best you can do is look at PERIOD_M1 and use iBarshift to get the bar number then you can get the OHLC (Bid values) that occurred during that 60 secs. You can't get the Bid or Ask for a specific second.
 
Thank you for your quick help.
 
zaffrono:
Thank you for your quick help.

This is the code I just made below. Now, How can I get the Bar Number? because, after I ran this code the value I got for the shift was 0.


  datetime some_time=D'2012.02.09 12:21:22';
  int      shift=iBarShift("EUROUSD",PERIOD_M1,some_time);
  Comment("shift of bar with open time ",TimeToStr(some_time)," is ",shift);
 
Has 12:21 on your Broker's Time Zone happened yet ?
 
RaptorUK:
Has 12:21 on your Broker's Time Zone happened yet ?
Yes, it has happened.
 
zaffrono:
Yes, it has happened.

I just found out what the problem was. In this line,
int      shift=iBarShift("EUROUSD",PERIOD_M1,some_time);
I just changed it with the new one below. It works and I get the value 48. Is this value of 48 means the bar number?
int      shift=iBarShift("0",PERIOD_M1,some_time);

 
Should this "EUROUSD" be this "EURUSD" ?
 
zaffrono:
I just found out what the problem was. In this line,
I just changed it with the new one below. It works and I get the value 48. Is this value of 48 means the bar number?

Yep, 48 mins ago . . . current bar is bar 0, last complete minute on an M1 chart is 1, etc

 
RaptorUK:

Yep, 48 mins ago . . . current bar is bar 0, last complete minute on an M1 chart is 1, etc

Now, it works fine, however, when I am using the iopen function the value of iopen is 0. Here is the code below:

datetime some_time=D'2012.02.09 12:21:22';
  int      shift=iBarShift(0,PERIOD_M1,some_time);
  double  open=iOpen("0",PERIOD_M1,shift); 
  Comment("shift of bar with open time ",TimeToStr(some_time)," is ",shift," open price=",DoubleToStr(open,5));
 

You need to use either the Symbol name, example: "EURUSD", or NULL to represent the current chart . . . "0" is wrong, iOpen

Same applies to iBarShift . . .