problem with iBarShift() - need help please

 

My EA reads the server time and the currency from a File and then it tries to use the data in my iBraShift() function to get the opening price of a Bar which Shift point at. Here is the code below:

string pair=StringSubstr(TYPE,3+u,6);
string SEVTIME=StringSubstr(TYPE,144+zp,20); 

int shift=iBarShift(pair,PERIOD_M1,SEVTIME);
double openbar=iOpen(pair,PERIOD_M1,shift); 

Please note that pair refers to the currency pair, for example, "EURUSD" and SEVTIME refers to server time, for example, "2012.02.09 16:31:37". Now, here is my problem" If If I use the code as it is above I get Bar# something like 3400 etc. However, If I change the code a little bit I get the result I want. This is the revised code:

datetime time=D'2012.02.09 16:31:37';
int shift=iBarShift(pair,PERIOD_M1,time);
double openbar=iOpen(pair,PERIOD_M1,shift); 

Therefore, the problem is SEVTIME value. If I use the Print to see contents of SEVTIME, I can see it without any problem. How can I overcome this problem? Thank you in advance for your help.

 
string SEVTIME=StringSubstr(TYPE,144+zp,20); 
int shift=iBarShift(pair,PERIOD_M1,SEVTIME);

int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)

Third argument is NOT a string

 
WHRoeder:

int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)

Third argument is NOT a string

Thank you very much for your help.
Reason: