How to get CCI value with date and time.

 

Dear,

I want to get accurate CCI value on dateandtime. Example what was the CCI value in EURUSD '2014.09.16 23:19:53'. i write the code below:

 

int iBarBegin   = iBarShift(NULL, 0, '2014.09.16 23:19:53', true); 

double data = iCCI(NULL,PERIOD_M15,per2,PRICE_CLOSE,iBarBegin) ;

 

above iBarShift return Shift number on candle as 30.  then  i get CCI value of shift 30. but as you see i didn't get accurate value of CCI at  '2014.09.16 23:19:53', because i got only close price of that of CCI value.

 

if there any way to get accurate CCI value on that accurate time.  

 

Thanks 

 
capilta: above iBarShift return Shift number on candle as 30.  then  i get CCI value of shift 30. but as you see i didn't get accurate value of CCI at  '2014.09.16 23:19:53', because
int iBarBegin   = iBarShift(NULL, 0, '2014.09.16 23:19:53', true); 
double data = iCCI(NULL,PERIOD_M15,per2,PRICE_CLOSE,iBarBegin) ;
  1. You are mixing apples and oranges. IBarShift is giving you the shift for the current chart, but then you ask for the CCI from the M15. Won't work unless your chart happens to be M15.
  2. The third argument for iBarShift is a datetime. You are passing it a character. (Does that even compile?)
  3. What happens if there is not a bar for that date? You get a -1. Drop the true or check What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
Reason: