Accurate Yesterday's High, Low, Open, Close Prices

 

Hi there...

 

Im using the following code to get yesterdays high, low, open and close prices but i am not satisfied with the results...

Can anybody here help me with this so that i can get the real high, low, open, close..

 

tnx..

 

 

DateValues=y+"."+m+"."+d+" "+"00:00";

int shift=iBarShift(Symbol(),PERIOD_D1,StrToTime(DateValues),false);
double high=iHigh(Symbol(),PERIOD_D1,shift);
double low=iLow(Symbol(),PERIOD_D1,shift);
double close=iClose(Symbol(),PERIOD_D1,shift);
double open=iOpen(Symbol(),PERIOD_D1,shift);
 
raven.chrono:

 

Hi there...

 

Im using the following code to get yesterdays high, low, open and close prices but i am not satisfied with the results...

Can anybody here help me with this so that i can get the real high, low, open, close..

 

tnx..

Shift = 0 is current bar, shift = 1 previous bar, so to obtain OHLC for yesterday (previous day actually) :

double high=iHigh(Symbol(),PERIOD_D1,1);
double low=iLow(Symbol(),PERIOD_D1,1);
double close=iClose(Symbol(),PERIOD_D1,1);
double open=iOpen(Symbol(),PERIOD_D1,1);