First: there is NO such function as StrToDateNum. The function that actuall EXISTS is called StrToDateTime. And it returns DateTime, not datenum.
Therefore you should use DateTime() to compare: Dat = "02/04/2007"; Dat1 = StrToDateTime(Dat); BuyPrice = ValueWhen(DateTime()==Dat1,C,1); Best regards, Tomasz Janeczko amibroker.com ----- Original Message ----- From: Ken Close To: [email protected] Sent: Thursday, September 18, 2008 11:12 PM Subject: [amibroker] StrToDateNum I guess I do not understand the function StrToDateNum, as simple as the definition seems to be. I have a string "02/04/2007", say Dat = "02/04/2007"; Dat1 = StrToDateNum(Dat); I would like to find the Price on that date. BuyPrice = ValueWhen(DateNum()==Dat1,C,1); produces a large and incorrect value. Can someone help me with why the above does not produce the correct value? The Help definition for StrToDateNum has the example as "2007-Feb-04", but my string is formatted as mm/dd/yyyy. Would this be the reason? Thanks, Ken
