Finding bid/ask price at a particular servertime from history.
- Wont work in EA
- Can there be more Bid than Ask in a tick?
- That is....Slippage ?
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 ?
Yes, it has happened.
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);
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
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));