Hi Alex,

 

DateTimeToStr() is expecting a Number for it's argument and ValueWhen()
returns an Array.  Try this:

 

a = "";

 

dtBuy = ValueWhen(Buy,DateTime());

 

for (i=1; i<BarCount; i++)

{

 

if (Sell[i]==1)

{ 

a = a + DateTimeToStr(dtBuy[i]);

}

 

}

 

Regards, 

 

David

 

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of dralexchambers
Sent: 02/19/2007 2:56 PM
To: [email protected]
Subject: [amibroker] Date of a previous Buy() signal

 

Hi,

I am trying to format the date of a previous Buy signal to a string:

a = "";

for (i=1; i<BarCount; i++)
{

if (Sell[i]==1)
{ 
a = a + DateTimeToStr(ValueWhen(Buy,DateTime()));
}

}

However, the "a = a+..." line does not work. I get "Error 
5....Incorrect type".

Can anyone advise?

Oh - I need the loop to stay intact (ie. the "if (Sell[i]==1)..." 
code), as I have other processing code in this loop.

Thanks.

 

Reply via email to