PureBytes Links
Trading Reference Links
|
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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of dralexchambers
Sent: 02/19/2007 2:56 PM
To: amibroker@xxxxxxxxxxxxxxx
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.
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.3/693 - Release Date: 2/19/2007 5:01 PM
|