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);
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...

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
can we get a price of certain time,such as D'2008.01.21 12:00' / 2010.02.25 10:10?
thanks .