how to get such price ?

 

can we get a price of certain time,such as D'2008.01.21 12:00' / 2010.02.25 10:10?

thanks .

 
datetime some_time=D'2008.01.21 12:00';
int      shift=iBarShift("EUROUSD",PERIOD_H1,some_time);
Print("at 2008.01.21 12:00 Bid was - ",iOpen("EURUSD",PERIOD_H1,shift);
 

THANK YOU,

IF SOME_TIME IS NOT JUST THE OPEN TIME .WILL THE PRICE BE RIGHT ? ANY TIME IN THE HOUR .

datetime some_time=D'2008.01.21 12:10';////////////12:10:15
int      shift=iBarShift("EUROUSD",PERIOD_H1,some_time);
Print("at 2008.01.21 12:10 Bid was - ",iOpen("EURUSD",PERIOD_H1,shift);
 
read the documentation of iBarShift()
 
7bit:
read the documentation of iBarShift()


yes,i have read it,but i do not know if every minute correspond to a bar,

i set code to test this :

datetime stime=D'2000.09.28 13:37';
int limit1= iBarShift( "EURUSD",PERIOD_M1,stime);
int limit2= iBarShift( "USDCHF",PERIOD_M1,stime);

Print(limit1," ",limit2);

two limit value are not equal .

i want to get every price relationship between two pairs of every minute .

 

Every symbol has it own ticks history. Sometimes during the night or slow market there can be even history without bars, for ex. if between 04:00 and 04:02 there was no tick, you'll lack the 04:01 bar...

When you use iBarShift you need to check what value you recieved.


bar = iBarShift( "EURUSD", PERIOD_M1, SOME_TIME );

if ( iTime( "EURUSD", PERIOD_M1, bar ) > SOME_TIME ) { bar ++; } //<-- you need to be certain that it is your bar or at least a bar not older than yours...

Reason: